diff --git a/sdk/testbase/azure-mgmt-testbase/_meta.json b/sdk/testbase/azure-mgmt-testbase/_meta.json index c029901ac11b..611b3f08f730 100644 --- a/sdk/testbase/azure-mgmt-testbase/_meta.json +++ b/sdk/testbase/azure-mgmt-testbase/_meta.json @@ -1,11 +1,11 @@ { - "commit": "4047b23b6e1a6bf2203d20db86d2f5eab43f7340", + "commit": "8de2080f4c646dfb11187827141a0af19d2034c6", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.2.1", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/testbase/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.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/testbase/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/testbase/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/__init__.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/__init__.py index e5db93e6784a..8f0bdff9035f 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/__init__.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_configuration.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_configuration.py index 1676572c5cd4..21cd010d5378 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_configuration.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -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 azure.core.credentials import TokenCredential @@ -33,16 +27,16 @@ class TestBaseConfiguration(Configuration): # pylint: disable=too-many-instance :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string. 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 "2022-04-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-01-preview". 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(TestBaseConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-04-01-preview") # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", "2023-11-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -56,10 +50,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-testbase/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_serialization.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_serialization.py index 7c1dedb5133d..4bae2292227b 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_serialization.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,23 +38,38 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] class RawDeserializer: @@ -65,8 +81,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +174,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +202,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +233,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,12 +290,12 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: 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__) @@ -290,27 +304,27 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,13 +333,13 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} 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=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -339,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -387,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -399,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -412,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -453,7 +477,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -521,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -537,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -605,14 +629,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,26 +645,26 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore 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) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -659,8 +683,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -675,7 +699,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -718,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :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 :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -726,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return str(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) @@ -780,6 +804,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -843,7 +869,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -866,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -878,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -925,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -1001,10 +1036,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1164,7 +1199,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1245,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1269,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1335,7 +1371,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=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1355,7 +1391,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = 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 @@ -1416,7 +1452,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1480,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1474,7 +1510,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1489,7 +1525,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1499,7 +1535,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: @@ -1543,7 +1579,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1601,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1783,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1834,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1846,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1862,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1877,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1907,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + 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) @@ -1886,7 +1922,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1937,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1960,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1996,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_test_base.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_test_base.py index 7f0a9ea40b3d..2f039ab61031 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_test_base.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_test_base.py @@ -12,17 +12,31 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import TestBaseConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + ActionRequestsOperations, AnalysisResultsOperations, + AvailableInplaceUpgradeOSOperations, AvailableOSOperations, BillingHubServiceOperations, + ChatSessionOperations, + ChatSessionsOperations, + CredentialOperations, + CredentialsOperations, + CustomImagesOperations, CustomerEventsOperations, + DraftPackagesOperations, EmailEventsOperations, FavoriteProcessesOperations, + FeatureUpdateSupportedOsesOperations, + FirstPartyAppsOperations, FlightingRingsOperations, + FreeHourBalancesOperations, + GalleryAppSkusOperations, + GalleryAppsOperations, + ImageDefinitionsOperations, OSUpdatesOperations, Operations, PackagesOperations, @@ -32,6 +46,7 @@ TestSummariesOperations, TestTypesOperations, UsageOperations, + VHDsOperations, ) if TYPE_CHECKING: @@ -40,8 +55,24 @@ class TestBase: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Test Base. - + """Restful APIs for Test Base Action Requests. + + :ivar action_requests: ActionRequestsOperations operations + :vartype action_requests: azure.mgmt.testbase.operations.ActionRequestsOperations + :ivar chat_sessions: ChatSessionsOperations operations + :vartype chat_sessions: azure.mgmt.testbase.operations.ChatSessionsOperations + :ivar chat_session: ChatSessionOperations operations + :vartype chat_session: azure.mgmt.testbase.operations.ChatSessionOperations + :ivar custom_images: CustomImagesOperations operations + :vartype custom_images: azure.mgmt.testbase.operations.CustomImagesOperations + :ivar image_definitions: ImageDefinitionsOperations operations + :vartype image_definitions: azure.mgmt.testbase.operations.ImageDefinitionsOperations + :ivar vhds: VHDsOperations operations + :vartype vhds: azure.mgmt.testbase.operations.VHDsOperations + :ivar draft_packages: DraftPackagesOperations operations + :vartype draft_packages: azure.mgmt.testbase.operations.DraftPackagesOperations + :ivar free_hour_balances: FreeHourBalancesOperations operations + :vartype free_hour_balances: azure.mgmt.testbase.operations.FreeHourBalancesOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.testbase.operations.SkusOperations :ivar test_base_accounts: TestBaseAccountsOperations operations @@ -50,8 +81,17 @@ class TestBase: # pylint: disable=client-accepts-api-version-keyword,too-many-i :vartype usage: azure.mgmt.testbase.operations.UsageOperations :ivar available_os: AvailableOSOperations operations :vartype available_os: azure.mgmt.testbase.operations.AvailableOSOperations + :ivar feature_update_supported_oses: FeatureUpdateSupportedOsesOperations operations + :vartype feature_update_supported_oses: + azure.mgmt.testbase.operations.FeatureUpdateSupportedOsesOperations :ivar flighting_rings: FlightingRingsOperations operations :vartype flighting_rings: azure.mgmt.testbase.operations.FlightingRingsOperations + :ivar first_party_apps: FirstPartyAppsOperations operations + :vartype first_party_apps: azure.mgmt.testbase.operations.FirstPartyAppsOperations + :ivar gallery_apps: GalleryAppsOperations operations + :vartype gallery_apps: azure.mgmt.testbase.operations.GalleryAppsOperations + :ivar gallery_app_skus: GalleryAppSkusOperations operations + :vartype gallery_app_skus: azure.mgmt.testbase.operations.GalleryAppSkusOperations :ivar test_types: TestTypesOperations operations :vartype test_types: azure.mgmt.testbase.operations.TestTypesOperations :ivar packages: PackagesOperations operations @@ -74,13 +114,20 @@ class TestBase: # pylint: disable=client-accepts-api-version-keyword,too-many-i :vartype operations: azure.mgmt.testbase.operations.Operations :ivar billing_hub_service: BillingHubServiceOperations operations :vartype billing_hub_service: azure.mgmt.testbase.operations.BillingHubServiceOperations + :ivar available_inplace_upgrade_os: AvailableInplaceUpgradeOSOperations operations + :vartype available_inplace_upgrade_os: + azure.mgmt.testbase.operations.AvailableInplaceUpgradeOSOperations + :ivar credential: CredentialOperations operations + :vartype credential: azure.mgmt.testbase.operations.CredentialOperations + :ivar credentials: CredentialsOperations operations + :vartype credentials: azure.mgmt.testbase.operations.CredentialsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string. 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 "2022-04-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -95,19 +142,37 @@ def __init__( **kwargs: Any ) -> None: self._config = TestBaseConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + self.action_requests = ActionRequestsOperations(self._client, self._config, self._serialize, self._deserialize) + self.chat_sessions = ChatSessionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.chat_session = ChatSessionOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_images = CustomImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.image_definitions = ImageDefinitionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vhds = VHDsOperations(self._client, self._config, self._serialize, self._deserialize) + self.draft_packages = DraftPackagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.free_hour_balances = FreeHourBalancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) self.test_base_accounts = TestBaseAccountsOperations( self._client, self._config, self._serialize, self._deserialize ) self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) self.available_os = AvailableOSOperations(self._client, self._config, self._serialize, self._deserialize) + self.feature_update_supported_oses = FeatureUpdateSupportedOsesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.flighting_rings = FlightingRingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.first_party_apps = FirstPartyAppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_apps = GalleryAppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_app_skus = GalleryAppSkusOperations(self._client, self._config, self._serialize, self._deserialize) self.test_types = TestTypesOperations(self._client, self._config, self._serialize, self._deserialize) self.packages = PackagesOperations(self._client, self._config, self._serialize, self._deserialize) self.test_summaries = TestSummariesOperations(self._client, self._config, self._serialize, self._deserialize) @@ -125,6 +190,11 @@ def __init__( self.billing_hub_service = BillingHubServiceOperations( self._client, self._config, self._serialize, self._deserialize ) + self.available_inplace_upgrade_os = AvailableInplaceUpgradeOSOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.credential = CredentialOperations(self._client, self._config, self._serialize, self._deserialize) + self.credentials = CredentialsOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -148,15 +218,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> TestBase + def __enter__(self) -> "TestBase": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_vendor.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_vendor.py index 9aad73fc743e..0dafe0e287ff 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_vendor.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_vendor.py @@ -14,14 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_version.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_version.py index dfa6ee022f15..e5754a47ce68 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_version.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/__init__.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/__init__.py index 6e4681fbc1dc..1a7f9789f151 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/__init__.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/_configuration.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/_configuration.py index 2bb32012263a..3e866eedc648 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/_configuration.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -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 azure.core.credentials_async import AsyncTokenCredential @@ -33,16 +27,16 @@ class TestBaseConfiguration(Configuration): # pylint: disable=too-many-instance :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string. 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 "2022-04-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-01-preview". 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(TestBaseConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-04-01-preview") # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", "2023-11-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/_test_base.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/_test_base.py index 6d264d16dd29..483ed39a5aa7 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/_test_base.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/_test_base.py @@ -12,17 +12,31 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import TestBaseConfiguration from .operations import ( + ActionRequestsOperations, AnalysisResultsOperations, + AvailableInplaceUpgradeOSOperations, AvailableOSOperations, BillingHubServiceOperations, + ChatSessionOperations, + ChatSessionsOperations, + CredentialOperations, + CredentialsOperations, + CustomImagesOperations, CustomerEventsOperations, + DraftPackagesOperations, EmailEventsOperations, FavoriteProcessesOperations, + FeatureUpdateSupportedOsesOperations, + FirstPartyAppsOperations, FlightingRingsOperations, + FreeHourBalancesOperations, + GalleryAppSkusOperations, + GalleryAppsOperations, + ImageDefinitionsOperations, OSUpdatesOperations, Operations, PackagesOperations, @@ -32,6 +46,7 @@ TestSummariesOperations, TestTypesOperations, UsageOperations, + VHDsOperations, ) if TYPE_CHECKING: @@ -40,8 +55,24 @@ class TestBase: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Test Base. - + """Restful APIs for Test Base Action Requests. + + :ivar action_requests: ActionRequestsOperations operations + :vartype action_requests: azure.mgmt.testbase.aio.operations.ActionRequestsOperations + :ivar chat_sessions: ChatSessionsOperations operations + :vartype chat_sessions: azure.mgmt.testbase.aio.operations.ChatSessionsOperations + :ivar chat_session: ChatSessionOperations operations + :vartype chat_session: azure.mgmt.testbase.aio.operations.ChatSessionOperations + :ivar custom_images: CustomImagesOperations operations + :vartype custom_images: azure.mgmt.testbase.aio.operations.CustomImagesOperations + :ivar image_definitions: ImageDefinitionsOperations operations + :vartype image_definitions: azure.mgmt.testbase.aio.operations.ImageDefinitionsOperations + :ivar vhds: VHDsOperations operations + :vartype vhds: azure.mgmt.testbase.aio.operations.VHDsOperations + :ivar draft_packages: DraftPackagesOperations operations + :vartype draft_packages: azure.mgmt.testbase.aio.operations.DraftPackagesOperations + :ivar free_hour_balances: FreeHourBalancesOperations operations + :vartype free_hour_balances: azure.mgmt.testbase.aio.operations.FreeHourBalancesOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.testbase.aio.operations.SkusOperations :ivar test_base_accounts: TestBaseAccountsOperations operations @@ -50,8 +81,17 @@ class TestBase: # pylint: disable=client-accepts-api-version-keyword,too-many-i :vartype usage: azure.mgmt.testbase.aio.operations.UsageOperations :ivar available_os: AvailableOSOperations operations :vartype available_os: azure.mgmt.testbase.aio.operations.AvailableOSOperations + :ivar feature_update_supported_oses: FeatureUpdateSupportedOsesOperations operations + :vartype feature_update_supported_oses: + azure.mgmt.testbase.aio.operations.FeatureUpdateSupportedOsesOperations :ivar flighting_rings: FlightingRingsOperations operations :vartype flighting_rings: azure.mgmt.testbase.aio.operations.FlightingRingsOperations + :ivar first_party_apps: FirstPartyAppsOperations operations + :vartype first_party_apps: azure.mgmt.testbase.aio.operations.FirstPartyAppsOperations + :ivar gallery_apps: GalleryAppsOperations operations + :vartype gallery_apps: azure.mgmt.testbase.aio.operations.GalleryAppsOperations + :ivar gallery_app_skus: GalleryAppSkusOperations operations + :vartype gallery_app_skus: azure.mgmt.testbase.aio.operations.GalleryAppSkusOperations :ivar test_types: TestTypesOperations operations :vartype test_types: azure.mgmt.testbase.aio.operations.TestTypesOperations :ivar packages: PackagesOperations operations @@ -74,13 +114,20 @@ class TestBase: # pylint: disable=client-accepts-api-version-keyword,too-many-i :vartype operations: azure.mgmt.testbase.aio.operations.Operations :ivar billing_hub_service: BillingHubServiceOperations operations :vartype billing_hub_service: azure.mgmt.testbase.aio.operations.BillingHubServiceOperations + :ivar available_inplace_upgrade_os: AvailableInplaceUpgradeOSOperations operations + :vartype available_inplace_upgrade_os: + azure.mgmt.testbase.aio.operations.AvailableInplaceUpgradeOSOperations + :ivar credential: CredentialOperations operations + :vartype credential: azure.mgmt.testbase.aio.operations.CredentialOperations + :ivar credentials: CredentialsOperations operations + :vartype credentials: azure.mgmt.testbase.aio.operations.CredentialsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string. 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 "2022-04-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-11-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -95,19 +142,37 @@ def __init__( **kwargs: Any ) -> None: self._config = TestBaseConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + self.action_requests = ActionRequestsOperations(self._client, self._config, self._serialize, self._deserialize) + self.chat_sessions = ChatSessionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.chat_session = ChatSessionOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_images = CustomImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.image_definitions = ImageDefinitionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vhds = VHDsOperations(self._client, self._config, self._serialize, self._deserialize) + self.draft_packages = DraftPackagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.free_hour_balances = FreeHourBalancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) self.test_base_accounts = TestBaseAccountsOperations( self._client, self._config, self._serialize, self._deserialize ) self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) self.available_os = AvailableOSOperations(self._client, self._config, self._serialize, self._deserialize) + self.feature_update_supported_oses = FeatureUpdateSupportedOsesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.flighting_rings = FlightingRingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.first_party_apps = FirstPartyAppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_apps = GalleryAppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gallery_app_skus = GalleryAppSkusOperations(self._client, self._config, self._serialize, self._deserialize) self.test_types = TestTypesOperations(self._client, self._config, self._serialize, self._deserialize) self.packages = PackagesOperations(self._client, self._config, self._serialize, self._deserialize) self.test_summaries = TestSummariesOperations(self._client, self._config, self._serialize, self._deserialize) @@ -125,6 +190,11 @@ def __init__( self.billing_hub_service = BillingHubServiceOperations( self._client, self._config, self._serialize, self._deserialize ) + self.available_inplace_upgrade_os = AvailableInplaceUpgradeOSOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.credential = CredentialOperations(self._client, self._config, self._serialize, self._deserialize) + self.credentials = CredentialsOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -155,5 +225,5 @@ async def __aenter__(self) -> "TestBase": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/__init__.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/__init__.py index cc28e4238ea1..0714ecfdeb7d 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/__init__.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/__init__.py @@ -6,11 +6,23 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._action_requests_operations import ActionRequestsOperations +from ._chat_sessions_operations import ChatSessionsOperations +from ._chat_session_operations import ChatSessionOperations +from ._custom_images_operations import CustomImagesOperations +from ._image_definitions_operations import ImageDefinitionsOperations +from ._vhds_operations import VHDsOperations +from ._draft_packages_operations import DraftPackagesOperations +from ._free_hour_balances_operations import FreeHourBalancesOperations from ._skus_operations import SkusOperations from ._test_base_accounts_operations import TestBaseAccountsOperations from ._usage_operations import UsageOperations from ._available_os_operations import AvailableOSOperations +from ._feature_update_supported_oses_operations import FeatureUpdateSupportedOsesOperations from ._flighting_rings_operations import FlightingRingsOperations +from ._first_party_apps_operations import FirstPartyAppsOperations +from ._gallery_apps_operations import GalleryAppsOperations +from ._gallery_app_skus_operations import GalleryAppSkusOperations from ._test_types_operations import TestTypesOperations from ._packages_operations import PackagesOperations from ._test_summaries_operations import TestSummariesOperations @@ -22,17 +34,32 @@ from ._customer_events_operations import CustomerEventsOperations from ._operations import Operations from ._billing_hub_service_operations import BillingHubServiceOperations +from ._available_inplace_upgrade_os_operations import AvailableInplaceUpgradeOSOperations +from ._credential_operations import CredentialOperations +from ._credentials_operations import CredentialsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "ActionRequestsOperations", + "ChatSessionsOperations", + "ChatSessionOperations", + "CustomImagesOperations", + "ImageDefinitionsOperations", + "VHDsOperations", + "DraftPackagesOperations", + "FreeHourBalancesOperations", "SkusOperations", "TestBaseAccountsOperations", "UsageOperations", "AvailableOSOperations", + "FeatureUpdateSupportedOsesOperations", "FlightingRingsOperations", + "FirstPartyAppsOperations", + "GalleryAppsOperations", + "GalleryAppSkusOperations", "TestTypesOperations", "PackagesOperations", "TestSummariesOperations", @@ -44,6 +71,9 @@ "CustomerEventsOperations", "Operations", "BillingHubServiceOperations", + "AvailableInplaceUpgradeOSOperations", + "CredentialOperations", + "CredentialsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_action_requests_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_action_requests_operations.py new file mode 100644 index 000000000000..22acf228f257 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_action_requests_operations.py @@ -0,0 +1,455 @@ +# pylint: disable=too-many-lines +# 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._action_requests_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_put_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ActionRequestsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.aio.TestBase`'s + :attr:`action_requests` 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, test_base_account_name: str, action_request_name: str, **kwargs: Any + ) -> _models.ActionRequest: + """Get the action request under the specified test base account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param action_request_name: Required. + :type action_request_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActionRequest or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ActionRequest + :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.ActionRequest] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + action_request_name=action_request_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) + + _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("ActionRequest", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/actionRequests/{actionRequestName}" + } + + @overload + async def put( + self, + resource_group_name: str, + test_base_account_name: str, + action_request_name: str, + action_request: Optional[_models.ActionRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ActionRequest: + """Create (submit) an action request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param action_request_name: Required. + :type action_request_name: str + :param action_request: Default value is None. + :type action_request: ~azure.mgmt.testbase.models.ActionRequest + :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: ActionRequest or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ActionRequest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def put( + self, + resource_group_name: str, + test_base_account_name: str, + action_request_name: str, + action_request: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ActionRequest: + """Create (submit) an action request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param action_request_name: Required. + :type action_request_name: str + :param action_request: Default value is None. + :type action_request: IO + :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: ActionRequest or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ActionRequest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def put( + self, + resource_group_name: str, + test_base_account_name: str, + action_request_name: str, + action_request: Optional[Union[_models.ActionRequest, IO]] = None, + **kwargs: Any + ) -> _models.ActionRequest: + """Create (submit) an action request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param action_request_name: Required. + :type action_request_name: str + :param action_request: Is either a ActionRequest type or a IO type. Default value is None. + :type action_request: ~azure.mgmt.testbase.models.ActionRequest 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 + :return: ActionRequest or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ActionRequest + :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.ActionRequest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(action_request, (IOBase, bytes)): + _content = action_request + else: + if action_request is not None: + _json = self._serialize.body(action_request, "ActionRequest") + else: + _json = None + + request = build_put_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + action_request_name=action_request_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.put.metadata["url"], + 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("ActionRequest", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ActionRequest", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/actionRequests/{actionRequestName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, test_base_account_name: str, action_request_name: str, **kwargs: Any + ) -> None: + """Delete (revoke) an action request. Only requests in review can be deleted. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param action_request_name: Required. + :type action_request_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: + """ + 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, + test_base_account_name=test_base_account_name, + action_request_name=action_request_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) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/actionRequests/{actionRequestName}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + test_base_account_name: str, + request_type: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ActionRequest"]: + """List all action requests under the specified test base account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param request_type: Default value is None. + :type request_type: str + :param top: How many of the sorted items to consider including in the result set. Default value + is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ActionRequest or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.testbase.models.ActionRequest] + :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.ActionRequests] = 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_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + request_type=request_type, + top=top, + 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) + + 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("ActionRequests", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/actionRequests" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_analysis_results_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_analysis_results_operations.py index 8ab32645bbf4..45b6a6b7cc3a 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_analysis_results_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_analysis_results_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._analysis_results_operations import build_get_request, build_list_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +66,7 @@ def list( """Lists the Analysis Results of a Test Result. The result collection will only contain one element as all the data will be nested in a singleton object. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -95,10 +90,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AnalysisResultListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AnalysisResultListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -124,7 +117,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -140,7 +133,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -148,14 +141,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AnalysisResultListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -168,7 +162,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/analysisResults"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/analysisResults" + } @distributed_trace_async async def get( @@ -182,7 +178,7 @@ async def get( ) -> _models.AnalysisResultSingletonResource: """Gets an Analysis Result of a Test Result by name. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -212,10 +208,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AnalysisResultSingletonResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AnalysisResultSingletonResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -230,10 +224,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -250,4 +245,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/analysisResults/{analysisResultName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/analysisResults/{analysisResultName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_available_inplace_upgrade_os_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_available_inplace_upgrade_os_operations.py new file mode 100644 index 000000000000..2292dff6a143 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_available_inplace_upgrade_os_operations.py @@ -0,0 +1,229 @@ +# pylint: disable=too-many-lines +# 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, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +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._available_inplace_upgrade_os_operations import build_get_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AvailableInplaceUpgradeOSOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.aio.TestBase`'s + :attr:`available_inplace_upgrade_os` 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 + def list( + self, + resource_group_name: str, + test_base_account_name: str, + os_update_type: Union[str, _models.OsUpdateType], + **kwargs: Any + ) -> AsyncIterable["_models.AvailableInplaceUpgradeOSResource"]: + """Lists all the available In-place Upgrade OSs to a package under a Test Base Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param os_update_type: The type of the OS Update. Known values are: "SecurityUpdate", + "FeatureUpdate", and "InplaceUpgrade". Required. + :type os_update_type: str or ~azure.mgmt.testbase.models.OsUpdateType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableInplaceUpgradeOSResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.testbase.models.AvailableInplaceUpgradeOSResource] + :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.AvailableInplaceUpgradeOSListResult] = 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_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + os_update_type=os_update_type, + 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) + + 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("AvailableInplaceUpgradeOSListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableInplaceUpgradeOSs" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + test_base_account_name: str, + available_inplace_upgrade_os_resource_name: str, + **kwargs: Any + ) -> _models.AvailableInplaceUpgradeOSResource: + """Gets an available In-place Upgrade OS to run a package under a Test Base Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param available_inplace_upgrade_os_resource_name: The resource name of an Available In-place + Upgrade OS. Required. + :type available_inplace_upgrade_os_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableInplaceUpgradeOSResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.AvailableInplaceUpgradeOSResource + :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.AvailableInplaceUpgradeOSResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + available_inplace_upgrade_os_resource_name=available_inplace_upgrade_os_resource_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) + + _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("AvailableInplaceUpgradeOSResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableInplaceUpgradeOSs/{availableInplaceUpgradeOSResourceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_available_os_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_available_os_operations.py index ca579b102226..056d5be8edc4 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_available_os_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_available_os_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._available_os_operations import build_get_request, build_list_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,13 +63,13 @@ def list( ) -> AsyncIterable["_models.AvailableOSResource"]: """Lists all the available OSs to run a package under a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str - :param os_update_type: The type of the OS Update. Known values are: "SecurityUpdate" and - "FeatureUpdate". Required. + :param os_update_type: The type of the OS Update. Known values are: "SecurityUpdate", + "FeatureUpdate", and "InplaceUpgrade". Required. :type os_update_type: str or ~azure.mgmt.testbase.models.OsUpdateType :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOSResource or the result of cls(response) @@ -85,10 +80,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailableOSListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AvailableOSListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -112,7 +105,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -128,7 +121,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -136,14 +129,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AvailableOSListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -156,7 +150,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableOSs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableOSs" + } @distributed_trace_async async def get( @@ -164,7 +160,7 @@ async def get( ) -> _models.AvailableOSResource: """Gets an available OS to run a package under a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -187,10 +183,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailableOSResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AvailableOSResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -203,10 +197,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -223,4 +218,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableOSs/{availableOSResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableOSs/{availableOSResourceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_billing_hub_service_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_billing_hub_service_operations.py index 671d52976491..f5c82cb77597 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_billing_hub_service_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_billing_hub_service_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +28,6 @@ from ..._vendor import _convert_request from ...operations._billing_hub_service_operations import build_get_free_hour_balance_request, build_get_usage_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,7 +57,7 @@ async def get_free_hour_balance( ) -> _models.BillingHubGetFreeHourBalanceResponse: """get_free_hour_balance. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -82,10 +78,8 @@ async def get_free_hour_balance( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingHubGetFreeHourBalanceResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BillingHubGetFreeHourBalanceResponse] = kwargs.pop("cls", None) request = build_get_free_hour_balance_request( resource_group_name=resource_group_name, @@ -97,10 +91,11 @@ async def get_free_hour_balance( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -117,7 +112,9 @@ async def get_free_hour_balance( return deserialized - get_free_hour_balance.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getFreeHourBalance"} # type: ignore + get_free_hour_balance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getFreeHourBalance" + } @overload async def get_usage( @@ -131,7 +128,7 @@ async def get_usage( ) -> _models.BillingHubGetUsageResponse: """get_usage. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -159,7 +156,7 @@ async def get_usage( ) -> _models.BillingHubGetUsageResponse: """get_usage. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -185,12 +182,13 @@ async def get_usage( ) -> _models.BillingHubGetUsageResponse: """get_usage. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str - :param get_usage_request: Is either a model type or a IO type. Default value is None. + :param get_usage_request: Is either a BillingHubGetUsageRequest type or a IO type. Default + value is None. :type get_usage_request: ~azure.mgmt.testbase.models.BillingHubGetUsageRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -211,16 +209,14 @@ async def get_usage( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingHubGetUsageResponse] + 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.BillingHubGetUsageResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(get_usage_request, (IO, bytes)): + if isinstance(get_usage_request, (IOBase, bytes)): _content = get_usage_request else: if get_usage_request is not None: @@ -241,10 +237,11 @@ async def get_usage( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -261,4 +258,6 @@ async def get_usage( return deserialized - get_usage.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getUsage"} # type: ignore + get_usage.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getUsage" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_chat_session_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_chat_session_operations.py new file mode 100644 index 000000000000..33986c577f8d --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_chat_session_operations.py @@ -0,0 +1,299 @@ +# pylint: disable=too-many-lines +# 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, Optional, TypeVar, Union, cast, overload + +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._chat_session_operations import build_chat_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ChatSessionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.aio.TestBase`'s + :attr:`chat_session` 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") + + async def _chat_initial( + self, + resource_group_name: str, + test_base_account_name: str, + chat_session_name: str, + parameters: Union[_models.ChatRequest, IO], + **kwargs: Any + ) -> Optional[_models.ChatResponse]: + 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[Optional[_models.ChatResponse]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ChatRequest") + + request = build_chat_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + chat_session_name=chat_session_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._chat_initial.metadata["url"], + 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, 202]: + 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 = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ChatResponse", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _chat_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/chatSessions/{chatSessionName}/chat" + } + + @overload + async def begin_chat( + self, + resource_group_name: str, + test_base_account_name: str, + chat_session_name: str, + parameters: _models.ChatRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ChatResponse]: + """Start a new chat turn. Ask a question and see the answer in response. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param chat_session_name: The chat session name. Required. + :type chat_session_name: str + :param parameters: Payload to ask a question. Required. + :type parameters: ~azure.mgmt.testbase.models.ChatRequest + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ChatResponse or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.testbase.models.ChatResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_chat( + self, + resource_group_name: str, + test_base_account_name: str, + chat_session_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ChatResponse]: + """Start a new chat turn. Ask a question and see the answer in response. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param chat_session_name: The chat session name. Required. + :type chat_session_name: str + :param parameters: Payload to ask a question. Required. + :type parameters: IO + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ChatResponse or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.testbase.models.ChatResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_chat( + self, + resource_group_name: str, + test_base_account_name: str, + chat_session_name: str, + parameters: Union[_models.ChatRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ChatResponse]: + """Start a new chat turn. Ask a question and see the answer in response. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param chat_session_name: The chat session name. Required. + :type chat_session_name: str + :param parameters: Payload to ask a question. Is either a ChatRequest type or a IO type. + Required. + :type parameters: ~azure.mgmt.testbase.models.ChatRequest 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ChatResponse or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.testbase.models.ChatResponse] + :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.ChatResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._chat_initial( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + chat_session_name=chat_session_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ChatResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_chat.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/chatSessions/{chatSessionName}/chat" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_chat_sessions_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_chat_sessions_operations.py new file mode 100644 index 000000000000..6eed2e81956c --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_chat_sessions_operations.py @@ -0,0 +1,215 @@ +# pylint: disable=too-many-lines +# 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, AsyncIterable, Callable, Dict, Optional, TypeVar +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._chat_sessions_operations import build_get_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ChatSessionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.aio.TestBase`'s + :attr:`chat_sessions` 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 + def list( + self, resource_group_name: str, test_base_account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ChatSessionResource"]: + """List all chat sessions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ChatSessionResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.testbase.models.ChatSessionResource] + :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.ChatSessionResourceListResult] = 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_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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("ChatSessionResourceListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/chatSessions" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, test_base_account_name: str, chat_session_name: str, **kwargs: Any + ) -> _models.ChatSessionResource: + """Get a chat session. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param chat_session_name: The chat session name. Required. + :type chat_session_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ChatSessionResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ChatSessionResource + :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.ChatSessionResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + chat_session_name=chat_session_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) + + _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("ChatSessionResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/chatSessions/{chatSessionName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_credential_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_credential_operations.py new file mode 100644 index 000000000000..060b0e1efdf1 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_credential_operations.py @@ -0,0 +1,214 @@ +# pylint: disable=too-many-lines +# 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, AsyncIterable, Callable, Dict, Optional, TypeVar +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._credential_operations import build_get_request, build_list_by_test_base_account_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CredentialOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.aio.TestBase`'s + :attr:`credential` 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 + def list_by_test_base_account( + self, resource_group_name: str, test_base_account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CredentialResource"]: + """Lists all the Credentials under a Test Base Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CredentialResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.testbase.models.CredentialResource] + :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.CredentialListResult] = 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_test_base_account_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_test_base_account.metadata["url"], + 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("CredentialListResult", 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) + + list_by_test_base_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, test_base_account_name: str, credential_name: str, **kwargs: Any + ) -> _models.CredentialResource: + """Gets a test base credential Resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param credential_name: The credential resource name. Required. + :type credential_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.CredentialResource + :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.CredentialResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + credential_name=credential_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) + + _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("CredentialResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials/{credentialName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_credentials_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_credentials_operations.py new file mode 100644 index 000000000000..905dfd4fb8ad --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_credentials_operations.py @@ -0,0 +1,426 @@ +# pylint: disable=too-many-lines +# 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, Optional, TypeVar, Union, overload + +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_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._credentials_operations import build_create_request, build_delete_request, build_update_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CredentialsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.aio.TestBase`'s + :attr:`credentials` 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 + async def create( + self, + resource_group_name: str, + test_base_account_name: str, + credential_name: str, + parameters: _models.CredentialResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CredentialResource: + """Creates or replaces a Test Base Credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param credential_name: The credential resource name. Required. + :type credential_name: str + :param parameters: Parameters supplied to create a Test Base Credential. Required. + :type parameters: ~azure.mgmt.testbase.models.CredentialResource + :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: CredentialResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.CredentialResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + test_base_account_name: str, + credential_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CredentialResource: + """Creates or replaces a Test Base Credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param credential_name: The credential resource name. Required. + :type credential_name: str + :param parameters: Parameters supplied to create a Test Base Credential. Required. + :type parameters: IO + :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: CredentialResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.CredentialResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + test_base_account_name: str, + credential_name: str, + parameters: Union[_models.CredentialResource, IO], + **kwargs: Any + ) -> _models.CredentialResource: + """Creates or replaces a Test Base Credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param credential_name: The credential resource name. Required. + :type credential_name: str + :param parameters: Parameters supplied to create a Test Base Credential. Is either a + CredentialResource type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.CredentialResource 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 + :return: CredentialResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.CredentialResource + :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.CredentialResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CredentialResource") + + request = build_create_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + credential_name=credential_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + _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("CredentialResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("CredentialResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials/{credentialName}" + } + + @overload + async def update( + self, + resource_group_name: str, + test_base_account_name: str, + credential_name: str, + parameters: _models.CredentialResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CredentialResource: + """Updates an existing test base credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param credential_name: The credential resource name. Required. + :type credential_name: str + :param parameters: Parameters supplied to create a test base credential. Required. + :type parameters: ~azure.mgmt.testbase.models.CredentialResource + :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: CredentialResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.CredentialResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + test_base_account_name: str, + credential_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CredentialResource: + """Updates an existing test base credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param credential_name: The credential resource name. Required. + :type credential_name: str + :param parameters: Parameters supplied to create a test base credential. Required. + :type parameters: IO + :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: CredentialResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.CredentialResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + test_base_account_name: str, + credential_name: str, + parameters: Union[_models.CredentialResource, IO], + **kwargs: Any + ) -> _models.CredentialResource: + """Updates an existing test base credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param credential_name: The credential resource name. Required. + :type credential_name: str + :param parameters: Parameters supplied to create a test base credential. Is either a + CredentialResource type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.CredentialResource 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 + :return: CredentialResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.CredentialResource + :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.CredentialResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CredentialResource") + + request = build_update_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + credential_name=credential_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + _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("CredentialResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials/{credentialName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, test_base_account_name: str, credential_name: str, **kwargs: Any + ) -> None: + """Deletes an existing test base credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param credential_name: The credential resource name. Required. + :type credential_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: + """ + 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, + test_base_account_name=test_base_account_name, + credential_name=credential_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) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials/{credentialName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_custom_images_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_custom_images_operations.py new file mode 100644 index 000000000000..b16ada1427f8 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_custom_images_operations.py @@ -0,0 +1,749 @@ +# pylint: disable=too-many-lines +# 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, cast, 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._custom_images_operations import ( + build_check_image_name_availability_request, + build_create_request, + build_delete_request, + build_get_request, + build_list_by_test_base_account_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CustomImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.aio.TestBase`'s + :attr:`custom_images` 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 + def list_by_test_base_account( + self, resource_group_name: str, test_base_account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CustomImageResource"]: + """Lists all the custom images under a test base account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomImageResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.testbase.models.CustomImageResource] + :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.CustomImageListResult] = 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_test_base_account_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_test_base_account.metadata["url"], + 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("CustomImageListResult", 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) + + list_by_test_base_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages" + } + + async def _create_initial( + self, + resource_group_name: str, + test_base_account_name: str, + custom_image_name: str, + parameters: Union[_models.CustomImageResource, IO], + **kwargs: Any + ) -> _models.CustomImageResource: + 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.CustomImageResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CustomImageResource") + + request = build_create_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + custom_image_name=custom_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + 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) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CustomImageResource", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("CustomImageResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages/{customImageName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + test_base_account_name: str, + custom_image_name: str, + parameters: _models.CustomImageResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomImageResource]: + """Creates a test base custom image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param custom_image_name: The resource name of the test base custom image. Required. + :type custom_image_name: str + :param parameters: Parameters supplied to create a test base custom image. Required. + :type parameters: ~azure.mgmt.testbase.models.CustomImageResource + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomImageResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.testbase.models.CustomImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + test_base_account_name: str, + custom_image_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomImageResource]: + """Creates a test base custom image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param custom_image_name: The resource name of the test base custom image. Required. + :type custom_image_name: str + :param parameters: Parameters supplied to create a test base custom image. Required. + :type parameters: IO + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomImageResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.testbase.models.CustomImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + test_base_account_name: str, + custom_image_name: str, + parameters: Union[_models.CustomImageResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.CustomImageResource]: + """Creates a test base custom image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param custom_image_name: The resource name of the test base custom image. Required. + :type custom_image_name: str + :param parameters: Parameters supplied to create a test base custom image. Is either a + CustomImageResource type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.CustomImageResource 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomImageResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.testbase.models.CustomImageResource] + :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.CustomImageResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + custom_image_name=custom_image_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomImageResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages/{customImageName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, test_base_account_name: str, custom_image_name: str, **kwargs: Any + ) -> None: + 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, + test_base_account_name=test_base_account_name, + custom_image_name=custom_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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 [202, 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) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages/{customImageName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, test_base_account_name: str, custom_image_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a test base custom image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param custom_image_name: The resource name of the test base custom image. Required. + :type custom_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :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[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + custom_image_name=custom_image_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages/{customImageName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, test_base_account_name: str, custom_image_name: str, **kwargs: Any + ) -> _models.CustomImageResource: + """Gets a test base custom image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param custom_image_name: The resource name of the test base custom image. Required. + :type custom_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomImageResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.CustomImageResource + :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.CustomImageResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + custom_image_name=custom_image_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) + + _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("CustomImageResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages/{customImageName}" + } + + @overload + async def check_image_name_availability( + self, + resource_group_name: str, + test_base_account_name: str, + parameters: _models.ImageNameCheckAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VerificationResult: + """Checks that the test vase custom image generated from VHD resource has valid and unique + definition and version, return architecture and OS state of potential existing image + definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param parameters: Parameters supplied to the test base custom image CheckAvailability + operation. Required. + :type parameters: ~azure.mgmt.testbase.models.ImageNameCheckAvailabilityParameters + :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: VerificationResult or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.VerificationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_image_name_availability( + self, + resource_group_name: str, + test_base_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VerificationResult: + """Checks that the test vase custom image generated from VHD resource has valid and unique + definition and version, return architecture and OS state of potential existing image + definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param parameters: Parameters supplied to the test base custom image CheckAvailability + operation. Required. + :type parameters: IO + :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: VerificationResult or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.VerificationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_image_name_availability( + self, + resource_group_name: str, + test_base_account_name: str, + parameters: Union[_models.ImageNameCheckAvailabilityParameters, IO], + **kwargs: Any + ) -> _models.VerificationResult: + """Checks that the test vase custom image generated from VHD resource has valid and unique + definition and version, return architecture and OS state of potential existing image + definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param parameters: Parameters supplied to the test base custom image CheckAvailability + operation. Is either a ImageNameCheckAvailabilityParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.ImageNameCheckAvailabilityParameters 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 + :return: VerificationResult or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.VerificationResult + :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.VerificationResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ImageNameCheckAvailabilityParameters") + + request = build_check_image_name_availability_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.check_image_name_availability.metadata["url"], + 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("VerificationResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_image_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/checkImageNameAvailability" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_customer_events_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_customer_events_operations.py index 78596d887176..1aafa5886a9b 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_customer_events_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_customer_events_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ build_list_by_test_base_account_request, ) -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +67,7 @@ def list_by_test_base_account( ) -> AsyncIterable["_models.CustomerEventResource"]: """Lists all notification events subscribed under a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -86,10 +82,8 @@ def list_by_test_base_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomerEventListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomerEventListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -112,7 +106,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -128,7 +122,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -136,14 +130,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("CustomerEventListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -156,7 +151,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_test_base_account.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents"} # type: ignore + list_by_test_base_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents" + } async def _create_initial( self, @@ -177,16 +174,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomerEventResource] + 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.CustomerEventResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CustomerEventResource") @@ -205,10 +200,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -230,11 +226,13 @@ async def _create_initial( deserialized = self._deserialize("CustomerEventResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}" + } @overload async def begin_create( @@ -249,7 +247,7 @@ async def begin_create( ) -> AsyncLROPoller[_models.CustomerEventResource]: """Create or replace a Test Base Customer Event. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -288,7 +286,7 @@ async def begin_create( ) -> AsyncLROPoller[_models.CustomerEventResource]: """Create or replace a Test Base Customer Event. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -325,15 +323,15 @@ async def begin_create( ) -> AsyncLROPoller[_models.CustomerEventResource]: """Create or replace a Test Base Customer Event. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str :param customer_event_name: The resource name of the Test Base Customer event. Required. :type customer_event_name: str - :param parameters: Parameters supplied to create a Test Base CustomerEvent. Is either a model - type or a IO type. Required. + :param parameters: Parameters supplied to create a Test Base CustomerEvent. Is either a + CustomerEventResource type or a IO type. Required. :type parameters: ~azure.mgmt.testbase.models.CustomerEventResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -354,16 +352,14 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomerEventResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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.CustomerEventResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, test_base_account_name=test_base_account_name, customer_event_name=customer_event_name, @@ -384,10 +380,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -399,9 +395,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, test_base_account_name: str, customer_event_name: str, **kwargs: Any @@ -417,10 +415,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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, @@ -433,10 +429,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -456,7 +453,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}" + } @distributed_trace_async async def begin_delete( @@ -464,7 +463,7 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Deletes a Test Base Customer Event. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -486,13 +485,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -511,10 +508,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -526,9 +523,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}" + } @distributed_trace_async async def get( @@ -536,7 +535,7 @@ async def get( ) -> _models.CustomerEventResource: """Gets a Test Base CustomerEvent. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -559,10 +558,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomerEventResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomerEventResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -575,10 +572,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -595,4 +593,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_draft_packages_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_draft_packages_operations.py new file mode 100644 index 000000000000..7184e3b7233d --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_draft_packages_operations.py @@ -0,0 +1,1389 @@ +# pylint: disable=too-many-lines +# 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, cast, 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._draft_packages_operations import ( + build_copy_from_package_request, + build_create_request, + build_delete_request, + build_extract_file_request, + build_generate_folders_and_scripts_request, + build_get_path_request, + build_get_request, + build_list_by_test_base_account_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DraftPackagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.aio.TestBase`'s + :attr:`draft_packages` 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 + def list_by_test_base_account( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: Optional[str] = None, + edit_package: Optional[bool] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DraftPackageResource"]: + """Lists all the draft packages under a test base account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param package_name: Parameter used to filter draft packages by linked Test Base Package. + Default value is None. + :type package_name: str + :param edit_package: Parameter used to filter draft packages by editPackage property. Default + value is None. + :type edit_package: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DraftPackageResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.testbase.models.DraftPackageResource] + :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.DraftPackageListResult] = 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_test_base_account_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + package_name=package_name, + edit_package=edit_package, + api_version=api_version, + template_url=self.list_by_test_base_account.metadata["url"], + 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("DraftPackageListResult", 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) + + list_by_test_base_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages" + } + + @overload + async def create( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: _models.DraftPackageResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DraftPackageResource: + """Creates or replaces a Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to create a Test Base Draft Package. Required. + :type parameters: ~azure.mgmt.testbase.models.DraftPackageResource + :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: DraftPackageResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.DraftPackageResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DraftPackageResource: + """Creates or replaces a Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to create a Test Base Draft Package. Required. + :type parameters: IO + :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: DraftPackageResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.DraftPackageResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: Union[_models.DraftPackageResource, IO], + **kwargs: Any + ) -> _models.DraftPackageResource: + """Creates or replaces a Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to create a Test Base Draft Package. Is either a + DraftPackageResource type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.DraftPackageResource 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 + :return: DraftPackageResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.DraftPackageResource + :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.DraftPackageResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "DraftPackageResource") + + request = build_create_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + _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("DraftPackageResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DraftPackageResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}" + } + + @overload + async def update( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: _models.DraftPackageUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DraftPackageResource: + """Updates an existing Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to update a Test Base Draft Package. Required. + :type parameters: ~azure.mgmt.testbase.models.DraftPackageUpdateParameters + :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: DraftPackageResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.DraftPackageResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DraftPackageResource: + """Updates an existing Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to update a Test Base Draft Package. Required. + :type parameters: IO + :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: DraftPackageResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.DraftPackageResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: Union[_models.DraftPackageUpdateParameters, IO], + **kwargs: Any + ) -> _models.DraftPackageResource: + """Updates an existing Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to update a Test Base Draft Package. Is either a + DraftPackageUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.DraftPackageUpdateParameters 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 + :return: DraftPackageResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.DraftPackageResource + :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.DraftPackageResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "DraftPackageUpdateParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + _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("DraftPackageResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, test_base_account_name: str, draft_package_name: str, **kwargs: Any + ) -> None: + """Deletes a Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_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: + """ + 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, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_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) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, test_base_account_name: str, draft_package_name: str, **kwargs: Any + ) -> _models.DraftPackageResource: + """Gets a Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DraftPackageResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.DraftPackageResource + :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.DraftPackageResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_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) + + _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("DraftPackageResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}" + } + + @distributed_trace_async + async def get_path( + self, resource_group_name: str, test_base_account_name: str, draft_package_name: str, **kwargs: Any + ) -> _models.DraftPackageGetPathResponse: + """Gets draft package path and temp working path with SAS. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DraftPackageGetPathResponse or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.DraftPackageGetPathResponse + :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.DraftPackageGetPathResponse] = kwargs.pop("cls", None) + + request = build_get_path_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_path.metadata["url"], + 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("DraftPackageGetPathResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_path.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/getPath" + } + + async def _copy_from_package_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: Union[_models.CopyFromPackageOperationParameters, IO], + **kwargs: Any + ) -> None: + 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[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CopyFromPackageOperationParameters") + + request = build_copy_from_package_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._copy_from_package_initial.metadata["url"], + 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 [202]: + 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) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _copy_from_package_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/copyFromPackage" + } + + @overload + async def begin_copy_from_package( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: _models.CopyFromPackageOperationParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Copy package file and metadata from a package to this draft package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package CopyFromPackage + operation. Required. + :type parameters: ~azure.mgmt.testbase.models.CopyFromPackageOperationParameters + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_copy_from_package( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Copy package file and metadata from a package to this draft package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package CopyFromPackage + operation. Required. + :type parameters: IO + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_copy_from_package( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: Union[_models.CopyFromPackageOperationParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Copy package file and metadata from a package to this draft package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package CopyFromPackage + operation. Is either a CopyFromPackageOperationParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.CopyFromPackageOperationParameters 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :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[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._copy_from_package_initial( # type: ignore + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_copy_from_package.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/copyFromPackage" + } + + async def _extract_file_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: Union[_models.ExtractFileOperationParameters, IO], + **kwargs: Any + ) -> None: + 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[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ExtractFileOperationParameters") + + request = build_extract_file_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._extract_file_initial.metadata["url"], + 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 [202]: + 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) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _extract_file_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/extractFile" + } + + @overload + async def begin_extract_file( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: _models.ExtractFileOperationParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Performs extracting file operation for a Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package ExtractFile operation. + Required. + :type parameters: ~azure.mgmt.testbase.models.ExtractFileOperationParameters + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_extract_file( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Performs extracting file operation for a Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package ExtractFile operation. + Required. + :type parameters: IO + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_extract_file( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: Union[_models.ExtractFileOperationParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Performs extracting file operation for a Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package ExtractFile operation. Is + either a ExtractFileOperationParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.ExtractFileOperationParameters 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :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[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._extract_file_initial( # type: ignore + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_extract_file.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/extractFile" + } + + async def _generate_folders_and_scripts_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: Union[_models.GenerateOperationParameters, IO], + **kwargs: Any + ) -> None: + 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[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "GenerateOperationParameters") + + request = build_generate_folders_and_scripts_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_folders_and_scripts_initial.metadata["url"], + 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 [202]: + 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) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _generate_folders_and_scripts_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/generateFoldersAndScripts" + } + + @overload + async def begin_generate_folders_and_scripts( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: _models.GenerateOperationParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Generates folders and scripts. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package Generate operation. + Required. + :type parameters: ~azure.mgmt.testbase.models.GenerateOperationParameters + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_generate_folders_and_scripts( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Generates folders and scripts. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package Generate operation. + Required. + :type parameters: IO + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_generate_folders_and_scripts( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: Union[_models.GenerateOperationParameters, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Generates folders and scripts. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package Generate operation. Is + either a GenerateOperationParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.GenerateOperationParameters 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :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[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._generate_folders_and_scripts_initial( # type: ignore + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_folders_and_scripts.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/generateFoldersAndScripts" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_email_events_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_email_events_operations.py index 13b975edc364..af71d4ab8b0a 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_email_events_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_email_events_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._email_events_operations import build_get_request, build_list_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +59,7 @@ def list( ) -> AsyncIterable["_models.EmailEventResource"]: """Lists all the email events of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -77,10 +72,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmailEventListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EmailEventListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +96,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +112,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,14 +120,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("EmailEventListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -147,7 +141,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/emailEvents"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/emailEvents" + } @distributed_trace_async async def get( @@ -155,7 +151,7 @@ async def get( ) -> _models.EmailEventResource: """Gets a email event of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -178,10 +174,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmailEventResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EmailEventResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -194,10 +188,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -214,4 +209,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/emailEvents/{emailEventResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/emailEvents/{emailEventResourceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_favorite_processes_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_favorite_processes_operations.py index 5316870cd6ea..cc7f537957c3 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_favorite_processes_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_favorite_processes_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +36,6 @@ build_list_request, ) -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +65,7 @@ def list( ) -> AsyncIterable["_models.FavoriteProcessResource"]: """Lists the favorite processes for a specific package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -86,10 +82,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FavoriteProcessListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FavoriteProcessListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -113,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -129,7 +123,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -137,14 +131,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("FavoriteProcessListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -157,7 +152,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses" + } @overload async def create( @@ -173,7 +170,7 @@ async def create( ) -> _models.FavoriteProcessResource: """Create or replace a favorite process for a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -209,7 +206,7 @@ async def create( ) -> _models.FavoriteProcessResource: """Create or replace a favorite process for a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -243,7 +240,7 @@ async def create( ) -> _models.FavoriteProcessResource: """Create or replace a favorite process for a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -255,7 +252,7 @@ async def create( 'actualProcessName' in request body to submit the name. Required. :type favorite_process_resource_name: str :param parameters: Parameters supplied to create a favorite process in a package. Is either a - model type or a IO type. Required. + FavoriteProcessResource type or a IO type. Required. :type parameters: ~azure.mgmt.testbase.models.FavoriteProcessResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -276,16 +273,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FavoriteProcessResource] + 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.FavoriteProcessResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "FavoriteProcessResource") @@ -305,10 +300,11 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -325,7 +321,9 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -338,7 +336,7 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a favorite process for a specific package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -365,10 +363,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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, @@ -382,10 +378,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -398,7 +395,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}" + } @distributed_trace_async async def get( @@ -411,7 +410,7 @@ async def get( ) -> _models.FavoriteProcessResource: """Gets a favorite process for a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -438,10 +437,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FavoriteProcessResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FavoriteProcessResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -455,10 +452,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -475,4 +473,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_feature_update_supported_oses_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_feature_update_supported_oses_operations.py new file mode 100644 index 000000000000..37eae8d9e5a2 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_feature_update_supported_oses_operations.py @@ -0,0 +1,147 @@ +# pylint: disable=too-many-lines +# 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, AsyncIterable, Callable, Dict, Optional, TypeVar +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._feature_update_supported_oses_operations import build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FeatureUpdateSupportedOsesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.aio.TestBase`'s + :attr:`feature_update_supported_oses` 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 + def list( + self, resource_group_name: str, test_base_account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.FeatureUpdateSupportedOsesResource"]: + """Lists all the available OSs to run a package under a Test Base Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FeatureUpdateSupportedOsesResource or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.testbase.models.FeatureUpdateSupportedOsesResource] + :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.FeatureUpdateSupportedOsesResult] = 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_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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("FeatureUpdateSupportedOsesResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/featureUpdateSupportedOses" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_first_party_apps_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_first_party_apps_operations.py new file mode 100644 index 000000000000..0ddd4ca9aa06 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_first_party_apps_operations.py @@ -0,0 +1,216 @@ +# pylint: disable=too-many-lines +# 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, AsyncIterable, Callable, Dict, Optional, TypeVar +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._first_party_apps_operations import build_get_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FirstPartyAppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.aio.TestBase`'s + :attr:`first_party_apps` 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 + def list( + self, resource_group_name: str, test_base_account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.FirstPartyAppResource"]: + """Lists all first party applications currently available for test runs under a Test Base Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FirstPartyAppResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.testbase.models.FirstPartyAppResource] + :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.FirstPartyAppListResult] = 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_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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("FirstPartyAppListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/firstPartyApps" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, test_base_account_name: str, first_party_app_resource_name: str, **kwargs: Any + ) -> _models.FirstPartyAppResource: + """Gets a first party application to prepare a test run for a Test Base Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param first_party_app_resource_name: The resource name of a first party application. Required. + :type first_party_app_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirstPartyAppResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.FirstPartyAppResource + :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.FirstPartyAppResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + first_party_app_resource_name=first_party_app_resource_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) + + _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("FirstPartyAppResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/firstPartyApps/{firstPartyAppResourceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_flighting_rings_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_flighting_rings_operations.py index 2572427d0c2b..5a94c3b4b965 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_flighting_rings_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_flighting_rings_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._flighting_rings_operations import build_get_request, build_list_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +59,7 @@ def list( ) -> AsyncIterable["_models.FlightingRingResource"]: """Lists all the flighting rings of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -79,10 +74,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FlightingRingListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FlightingRingListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -105,7 +98,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -121,7 +114,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -129,14 +122,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("FlightingRingListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,7 +143,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/flightingRings"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/flightingRings" + } @distributed_trace_async async def get( @@ -157,7 +153,7 @@ async def get( ) -> _models.FlightingRingResource: """Gets a flighting ring of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -180,10 +176,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FlightingRingResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FlightingRingResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -196,10 +190,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -216,4 +211,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/flightingRings/{flightingRingResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/flightingRings/{flightingRingResourceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_free_hour_balances_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_free_hour_balances_operations.py new file mode 100644 index 000000000000..0ae2fe8d4274 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_free_hour_balances_operations.py @@ -0,0 +1,226 @@ +# pylint: disable=too-many-lines +# 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, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +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._free_hour_balances_operations import build_get_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FreeHourBalancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.aio.TestBase`'s + :attr:`free_hour_balances` 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 + def list( + self, resource_group_name: str, test_base_account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.FreeHourBalanceResource"]: + """List all the free hour balances of a test base account. The result collection will only contain + one element as all the data will be nested in a singleton object. + + Return the Test Base free hour balances list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FreeHourBalanceResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.testbase.models.FreeHourBalanceResource] + :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.FreeHourBalancesListResult] = 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_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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("FreeHourBalancesListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/freeHourBalances" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + test_base_account_name: str, + free_hour_balance_name: Union[str, _models.FreeHourBalanceName], + **kwargs: Any + ) -> _models.FreeHourBalanceResource: + """Get the free hour balance of a test base account. + + Return the Test Base free hour balance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param free_hour_balance_name: The name of the free hour balance of a Test Base Account. Known + values are: "TenantLevel" and "SubscriptionLevel". Required. + :type free_hour_balance_name: str or ~azure.mgmt.testbase.models.FreeHourBalanceName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FreeHourBalanceResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.FreeHourBalanceResource + :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.FreeHourBalanceResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + free_hour_balance_name=free_hour_balance_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) + + _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("FreeHourBalanceResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/freeHourBalances/{freeHourBalanceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_gallery_app_skus_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_gallery_app_skus_operations.py new file mode 100644 index 000000000000..0ccbd034d2f5 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_gallery_app_skus_operations.py @@ -0,0 +1,228 @@ +# pylint: disable=too-many-lines +# 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, AsyncIterable, Callable, Dict, Optional, TypeVar +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._gallery_app_skus_operations import build_get_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GalleryAppSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.aio.TestBase`'s + :attr:`gallery_app_skus` 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 + def list( + self, resource_group_name: str, test_base_account_name: str, gallery_app_name: str, **kwargs: Any + ) -> AsyncIterable["_models.GalleryAppSkuResource"]: + """Lists all SKUs of a gallery application currently available for test runs under a Test Base + Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param gallery_app_name: The resource name of a gallery application. Required. + :type gallery_app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryAppSkuResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.testbase.models.GalleryAppSkuResource] + :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.GalleryAppSkuListResult] = 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_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + gallery_app_name=gallery_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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("GalleryAppSkuListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/galleryApps/{galleryAppName}/galleryAppSkus" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + test_base_account_name: str, + gallery_app_name: str, + gallery_app_sku_name: str, + **kwargs: Any + ) -> _models.GalleryAppSkuResource: + """Gets a gallery application SKU to prepare a test run for a Test Base Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param gallery_app_name: The resource name of a gallery application. Required. + :type gallery_app_name: str + :param gallery_app_sku_name: The resource name of a gallery application SKU. Required. + :type gallery_app_sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GalleryAppSkuResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.GalleryAppSkuResource + :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.GalleryAppSkuResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + gallery_app_name=gallery_app_name, + gallery_app_sku_name=gallery_app_sku_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) + + _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("GalleryAppSkuResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/galleryApps/{galleryAppName}/galleryAppSkus/{galleryAppSkuName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_gallery_apps_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_gallery_apps_operations.py new file mode 100644 index 000000000000..e4bc44c33f36 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_gallery_apps_operations.py @@ -0,0 +1,236 @@ +# pylint: disable=too-many-lines +# 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, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +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._gallery_apps_operations import build_get_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GalleryAppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.aio.TestBase`'s + :attr:`gallery_apps` 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 + def list( + self, + resource_group_name: str, + test_base_account_name: str, + keyword: Optional[str] = None, + application_type: Optional[Union[str, _models.ApplicationType]] = None, + order_by: Union[str, _models.OrderBy] = "relevance", + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.GalleryAppResource"]: + """Lists all gallery applications currently available for test runs under a Test Base Account + which matches user query. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param keyword: The keywords which listed results should be related to. Default value is None. + :type keyword: str + :param application_type: The type of the gallery application. "Winget" Default value is None. + :type application_type: str or ~azure.mgmt.testbase.models.ApplicationType + :param order_by: The order of result list. Known values are: "popularity" and "relevance". + Default value is "relevance". + :type order_by: str or ~azure.mgmt.testbase.models.OrderBy + :param top: How many of the sorted items to consider including in the result set. Default value + is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryAppResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.testbase.models.GalleryAppResource] + :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.GalleryAppListResult] = 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_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + keyword=keyword, + application_type=application_type, + order_by=order_by, + top=top, + 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) + + 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("GalleryAppListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/galleryApps" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, test_base_account_name: str, gallery_app_name: str, **kwargs: Any + ) -> _models.GalleryAppResource: + """Gets a gallery application to prepare a test run for a Test Base Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param gallery_app_name: The resource name of a gallery application. Required. + :type gallery_app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GalleryAppResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.GalleryAppResource + :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.GalleryAppResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + gallery_app_name=gallery_app_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) + + _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("GalleryAppResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/galleryApps/{galleryAppName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_image_definitions_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_image_definitions_operations.py new file mode 100644 index 000000000000..9753a8dd267b --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_image_definitions_operations.py @@ -0,0 +1,445 @@ +# pylint: disable=too-many-lines +# 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._image_definitions_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_test_base_account_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ImageDefinitionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.aio.TestBase`'s + :attr:`image_definitions` 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 + def list_by_test_base_account( + self, resource_group_name: str, test_base_account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ImageDefinitionResource"]: + """List all image definition properties created by test base custom images which are derived from + 'VHD' source. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ImageDefinitionResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.testbase.models.ImageDefinitionResource] + :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.ImageDefinitionsListResult] = 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_test_base_account_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_test_base_account.metadata["url"], + 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("ImageDefinitionsListResult", 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) + + list_by_test_base_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/imageDefinitions" + } + + @overload + async def create( + self, + resource_group_name: str, + test_base_account_name: str, + image_definition_name: str, + parameters: _models.ImageDefinitionResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ImageDefinitionResource: + """Create image definition for test base custom images which are derived from 'VHD' source. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param image_definition_name: The resource name of the test base image definition. Required. + :type image_definition_name: str + :param parameters: Parameters supplied to create a test base image definition. Required. + :type parameters: ~azure.mgmt.testbase.models.ImageDefinitionResource + :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: ImageDefinitionResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ImageDefinitionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + test_base_account_name: str, + image_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ImageDefinitionResource: + """Create image definition for test base custom images which are derived from 'VHD' source. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param image_definition_name: The resource name of the test base image definition. Required. + :type image_definition_name: str + :param parameters: Parameters supplied to create a test base image definition. Required. + :type parameters: IO + :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: ImageDefinitionResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ImageDefinitionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + test_base_account_name: str, + image_definition_name: str, + parameters: Union[_models.ImageDefinitionResource, IO], + **kwargs: Any + ) -> _models.ImageDefinitionResource: + """Create image definition for test base custom images which are derived from 'VHD' source. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param image_definition_name: The resource name of the test base image definition. Required. + :type image_definition_name: str + :param parameters: Parameters supplied to create a test base image definition. Is either a + ImageDefinitionResource type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.ImageDefinitionResource 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 + :return: ImageDefinitionResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ImageDefinitionResource + :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.ImageDefinitionResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ImageDefinitionResource") + + request = build_create_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + image_definition_name=image_definition_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + _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("ImageDefinitionResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ImageDefinitionResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/imageDefinitions/{imageDefinitionName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, test_base_account_name: str, image_definition_name: str, **kwargs: Any + ) -> _models.ImageDefinitionResource: + """Get image properties under the image definition name created by test base custom image which + derived from 'VHD' source. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param image_definition_name: The resource name of the test base image definition. Required. + :type image_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ImageDefinitionResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ImageDefinitionResource + :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.ImageDefinitionResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + image_definition_name=image_definition_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) + + _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("ImageDefinitionResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/imageDefinitions/{imageDefinitionName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, test_base_account_name: str, image_definition_name: str, **kwargs: Any + ) -> None: + """Delete a test base image definition resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param image_definition_name: The resource name of the test base image definition. Required. + :type image_definition_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: + """ + 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, + test_base_account_name=test_base_account_name, + image_definition_name=image_definition_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) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/imageDefinitions/{imageDefinitionName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_operations.py index 3eee504d2a72..05ec5112bf6e 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,10 +64,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -92,7 +85,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -108,7 +101,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -116,14 +109,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -136,4 +130,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.TestBase/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.TestBase/operations"} diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_os_updates_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_os_updates_operations.py index d8f6e605689e..c2c667967483 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_os_updates_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_os_updates_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._os_updates_operations import build_get_request, build_list_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,15 +64,15 @@ def list( ) -> AsyncIterable["_models.OSUpdateResource"]: """Lists the OS Updates in which the package were tested before. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str :param package_name: The resource name of the Test Base Package. Required. :type package_name: str - :param os_update_type: The type of the OS Update. Known values are: "SecurityUpdate" and - "FeatureUpdate". Required. + :param os_update_type: The type of the OS Update. Known values are: "SecurityUpdate", + "FeatureUpdate", and "InplaceUpgrade". Required. :type os_update_type: str or ~azure.mgmt.testbase.models.OsUpdateType :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OSUpdateResource or the result of cls(response) @@ -87,10 +82,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OSUpdateListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OSUpdateListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -115,7 +108,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -131,7 +124,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -139,14 +132,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OSUpdateListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -159,7 +153,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/osUpdates"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/osUpdates" + } @distributed_trace_async async def get( @@ -172,7 +168,7 @@ async def get( ) -> _models.OSUpdateResource: """Gets an OS Update by name in which the package was tested before. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -197,10 +193,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OSUpdateResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OSUpdateResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -214,10 +208,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,4 +229,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/osUpdates/{osUpdateResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/osUpdates/{osUpdateResourceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_packages_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_packages_operations.py index 1ba43278698e..92fcad03cc96 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_packages_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_packages_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -42,10 +42,6 @@ build_update_request, ) -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +71,7 @@ def list_by_test_base_account( ) -> AsyncIterable["_models.PackageResource"]: """Lists all the packages under a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -88,10 +84,8 @@ def list_by_test_base_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PackageListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PackageListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -114,7 +108,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -130,7 +124,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -138,14 +132,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PackageListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -158,7 +153,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_test_base_account.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages"} # type: ignore + list_by_test_base_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages" + } async def _create_initial( self, @@ -179,16 +176,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PackageResource] + 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.PackageResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PackageResource") @@ -207,10 +202,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,11 +228,13 @@ async def _create_initial( deserialized = self._deserialize("PackageResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" + } @overload async def begin_create( @@ -251,7 +249,7 @@ async def begin_create( ) -> AsyncLROPoller[_models.PackageResource]: """Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -290,7 +288,7 @@ async def begin_create( ) -> AsyncLROPoller[_models.PackageResource]: """Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -327,15 +325,15 @@ async def begin_create( ) -> AsyncLROPoller[_models.PackageResource]: """Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str :param package_name: The resource name of the Test Base Package. Required. :type package_name: str - :param parameters: Parameters supplied to create a Test Base Package. Is either a model type or - a IO type. Required. + :param parameters: Parameters supplied to create a Test Base Package. Is either a + PackageResource type or a IO type. Required. :type parameters: ~azure.mgmt.testbase.models.PackageResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -356,16 +354,14 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PackageResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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.PackageResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, test_base_account_name=test_base_account_name, package_name=package_name, @@ -386,10 +382,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -401,9 +397,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" + } async def _update_initial( self, @@ -424,16 +422,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PackageResource]] + 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[Optional[_models.PackageResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PackageUpdateParameters") @@ -452,10 +448,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,7 +484,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" + } @overload async def begin_update( @@ -502,7 +501,7 @@ async def begin_update( ) -> AsyncLROPoller[_models.PackageResource]: """Update an existing Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -541,7 +540,7 @@ async def begin_update( ) -> AsyncLROPoller[_models.PackageResource]: """Update an existing Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -578,15 +577,15 @@ async def begin_update( ) -> AsyncLROPoller[_models.PackageResource]: """Update an existing Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str :param package_name: The resource name of the Test Base Package. Required. :type package_name: str - :param parameters: Parameters supplied to update a Test Base Package. Is either a model type or - a IO type. Required. + :param parameters: Parameters supplied to update a Test Base Package. Is either a + PackageUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.testbase.models.PackageUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -607,16 +606,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PackageResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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.PackageResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, test_base_account_name=test_base_account_name, package_name=package_name, @@ -637,10 +634,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -652,9 +649,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, test_base_account_name: str, package_name: str, **kwargs: Any @@ -670,10 +669,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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, @@ -686,10 +683,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -709,7 +707,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" + } @distributed_trace_async async def begin_delete( @@ -717,7 +717,7 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Deletes a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -739,13 +739,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -764,10 +762,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -779,9 +777,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" + } @distributed_trace_async async def get( @@ -789,7 +789,7 @@ async def get( ) -> _models.PackageResource: """Gets a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -812,10 +812,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PackageResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PackageResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -828,10 +826,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -848,7 +847,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" + } async def _hard_delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, test_base_account_name: str, package_name: str, **kwargs: Any @@ -864,10 +865,8 @@ async def _hard_delete_initial( # pylint: disable=inconsistent-return-statement _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_hard_delete_request( resource_group_name=resource_group_name, @@ -880,10 +879,11 @@ async def _hard_delete_initial( # pylint: disable=inconsistent-return-statement params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -903,7 +903,9 @@ async def _hard_delete_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, response_headers) - _hard_delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/hardDelete"} # type: ignore + _hard_delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/hardDelete" + } @distributed_trace_async async def begin_hard_delete( @@ -911,7 +913,7 @@ async def begin_hard_delete( ) -> AsyncLROPoller[None]: """Hard Delete a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -933,13 +935,11 @@ async def begin_hard_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._hard_delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -958,10 +958,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -973,9 +973,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_hard_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/hardDelete"} # type: ignore + begin_hard_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/hardDelete" + } @distributed_trace_async async def get_download_url( @@ -983,7 +985,7 @@ async def get_download_url( ) -> _models.DownloadURLResponse: """Gets the download URL of a package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1006,10 +1008,8 @@ async def get_download_url( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadURLResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DownloadURLResponse] = kwargs.pop("cls", None) request = build_get_download_url_request( resource_group_name=resource_group_name, @@ -1022,10 +1022,11 @@ async def get_download_url( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1042,7 +1043,9 @@ async def get_download_url( return deserialized - get_download_url.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/getDownloadUrl"} # type: ignore + get_download_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/getDownloadUrl" + } @overload async def run_test( # pylint: disable=inconsistent-return-statements @@ -1057,7 +1060,7 @@ async def run_test( # pylint: disable=inconsistent-return-statements ) -> None: """Trigger a test run on the package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1089,7 +1092,7 @@ async def run_test( # pylint: disable=inconsistent-return-statements ) -> None: """Trigger a test run on the package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1119,7 +1122,7 @@ async def run_test( # pylint: disable=inconsistent-return-statements ) -> None: """Trigger a test run on the package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1127,7 +1130,7 @@ async def run_test( # pylint: disable=inconsistent-return-statements :param package_name: The resource name of the Test Base Package. Required. :type package_name: str :param parameters: The parameters supplied to the Test Base Package to start a Test Run. Is - either a model type or a IO type. Default value is None. + either a PackageRunTestParameters type or a IO type. Default value is None. :type parameters: ~azure.mgmt.testbase.models.PackageRunTestParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1148,16 +1151,14 @@ async def run_test( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: if parameters is not None: @@ -1179,10 +1180,11 @@ async def run_test( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1202,4 +1204,6 @@ async def run_test( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - run_test.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/runTest"} # type: ignore + run_test.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/runTest" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_skus_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_skus_operations.py index 67aa6977b4c0..ed33d97dfde5 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_skus_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_skus_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,10 +64,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.TestBaseAccountSKU"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestBaseAccountSKUListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestBaseAccountSKUListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -93,7 +86,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -109,7 +102,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -117,14 +110,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TestBaseAccountSKUListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -137,4 +131,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.TestBase/skus"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.TestBase/skus"} diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_accounts_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_accounts_operations.py index b6dbb1535aaa..08eac2faf5e8 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_accounts_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_base_accounts_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -43,10 +43,6 @@ build_update_request, ) -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +70,7 @@ def __init__(self, *args, **kwargs) -> None: def list_by_subscription( self, get_deleted: Optional[bool] = None, **kwargs: Any ) -> AsyncIterable["_models.TestBaseAccountResource"]: - """Lists all the Test Base Accounts in a subscription. This API is required by ARM guidelines. + """Lists all the Test Base Accounts in a subscription. :param get_deleted: The flag indicating if we need to include the Test Base Accounts which were soft deleted before. Default value is None. @@ -89,10 +85,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestBaseAccountListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestBaseAccountListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -114,7 +108,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -130,7 +124,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -138,14 +132,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TestBaseAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -158,7 +153,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.TestBase/testBaseAccounts"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.TestBase/testBaseAccounts" + } @distributed_trace def list_by_resource_group( @@ -166,7 +163,7 @@ def list_by_resource_group( ) -> AsyncIterable["_models.TestBaseAccountResource"]: """Lists all the Test Base Accounts in a resource group. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param get_deleted: The flag indicating if we need to include the Test Base Accounts which were @@ -182,10 +179,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestBaseAccountListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestBaseAccountListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -208,7 +203,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -224,7 +219,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -232,14 +227,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TestBaseAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -252,7 +248,9 @@ 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.TestBase/testBaseAccounts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts" + } async def _create_initial( self, @@ -273,16 +271,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestBaseAccountResource] + 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.TestBaseAccountResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TestBaseAccountResource") @@ -301,10 +297,11 @@ async def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -326,11 +323,13 @@ async def _create_initial( deserialized = self._deserialize("TestBaseAccountResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" + } @overload async def begin_create( @@ -346,7 +345,7 @@ async def begin_create( """Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified subscription. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -387,7 +386,7 @@ async def begin_create( """Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified subscription. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -426,13 +425,13 @@ async def begin_create( """Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified subscription. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str - :param parameters: Parameters supplied to create a Test Base Account. Is either a model type or - a IO type. Required. + :param parameters: Parameters supplied to create a Test Base Account. Is either a + TestBaseAccountResource type or a IO type. Required. :type parameters: ~azure.mgmt.testbase.models.TestBaseAccountResource or IO :param restore: The flag indicating if we would like to restore the Test Base Accounts which were soft deleted before. Default value is None. @@ -456,16 +455,14 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestBaseAccountResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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.TestBaseAccountResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, test_base_account_name=test_base_account_name, parameters=parameters, @@ -486,10 +483,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -501,9 +498,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" + } async def _update_initial( self, @@ -523,16 +522,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.TestBaseAccountResource]] + 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[Optional[_models.TestBaseAccountResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TestBaseAccountUpdateParameters") @@ -550,10 +547,11 @@ async def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -585,7 +583,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" + } @overload async def begin_update( @@ -599,7 +599,7 @@ async def begin_update( ) -> AsyncLROPoller[_models.TestBaseAccountResource]: """Update an existing Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -635,7 +635,7 @@ async def begin_update( ) -> AsyncLROPoller[_models.TestBaseAccountResource]: """Update an existing Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -669,13 +669,13 @@ async def begin_update( ) -> AsyncLROPoller[_models.TestBaseAccountResource]: """Update an existing Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str - :param parameters: Parameters supplied to update a Test Base Account. Is either a model type or - a IO type. Required. + :param parameters: Parameters supplied to update a Test Base Account. Is either a + TestBaseAccountUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.testbase.models.TestBaseAccountUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -696,16 +696,14 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestBaseAccountResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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.TestBaseAccountResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, test_base_account_name=test_base_account_name, parameters=parameters, @@ -725,10 +723,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -740,9 +738,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, test_base_account_name: str, **kwargs: Any @@ -758,10 +758,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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, @@ -773,10 +771,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -796,7 +795,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" + } @distributed_trace_async async def begin_delete( @@ -804,7 +805,7 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Deletes a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -824,13 +825,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -848,10 +847,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -863,9 +862,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" + } @distributed_trace_async async def get( @@ -873,7 +874,7 @@ async def get( ) -> _models.TestBaseAccountResource: """Gets a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -894,10 +895,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestBaseAccountResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestBaseAccountResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -909,10 +908,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -929,7 +929,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" + } async def _offboard_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, test_base_account_name: str, **kwargs: Any @@ -945,10 +947,8 @@ async def _offboard_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_offboard_request( resource_group_name=resource_group_name, @@ -960,10 +960,11 @@ async def _offboard_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -983,7 +984,9 @@ async def _offboard_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _offboard_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/offboard"} # type: ignore + _offboard_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/offboard" + } @distributed_trace_async async def begin_offboard( @@ -991,7 +994,7 @@ async def begin_offboard( ) -> AsyncLROPoller[None]: """Offboard a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1011,13 +1014,11 @@ async def begin_offboard( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._offboard_initial( # type: ignore resource_group_name=resource_group_name, @@ -1035,10 +1036,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1050,9 +1051,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_offboard.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/offboard"} # type: ignore + begin_offboard.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/offboard" + } @overload async def get_file_upload_url( @@ -1066,7 +1069,7 @@ async def get_file_upload_url( ) -> _models.FileUploadURLResponse: """Gets the file upload URL of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1095,7 +1098,7 @@ async def get_file_upload_url( ) -> _models.FileUploadURLResponse: """Gets the file upload URL of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1122,13 +1125,13 @@ async def get_file_upload_url( ) -> _models.FileUploadURLResponse: """Gets the file upload URL of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str :param parameters: Parameters supplied to the Test Base Account GetFileUploadURL operation. Is - either a model type or a IO type. Default value is None. + either a GetFileUploadURLParameters type or a IO type. Default value is None. :type parameters: ~azure.mgmt.testbase.models.GetFileUploadURLParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1149,16 +1152,14 @@ async def get_file_upload_url( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FileUploadURLResponse] + 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.FileUploadURLResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: if parameters is not None: @@ -1179,10 +1180,11 @@ async def get_file_upload_url( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1199,7 +1201,9 @@ async def get_file_upload_url( return deserialized - get_file_upload_url.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getFileUploadUrl"} # type: ignore + get_file_upload_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getFileUploadUrl" + } @overload async def check_package_name_availability( @@ -1213,7 +1217,7 @@ async def check_package_name_availability( ) -> _models.CheckNameAvailabilityResult: """Checks that the Test Base Package name and version is valid and is not already in use. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1242,7 +1246,7 @@ async def check_package_name_availability( ) -> _models.CheckNameAvailabilityResult: """Checks that the Test Base Package name and version is valid and is not already in use. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1269,13 +1273,13 @@ async def check_package_name_availability( ) -> _models.CheckNameAvailabilityResult: """Checks that the Test Base Package name and version is valid and is not already in use. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str :param parameters: Parameters supplied to the Test Base Package CheckNameAvailability - operation. Is either a model type or a IO type. Required. + operation. Is either a PackageCheckNameAvailabilityParameters type or a IO type. Required. :type parameters: ~azure.mgmt.testbase.models.PackageCheckNameAvailabilityParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1296,16 +1300,14 @@ async def check_package_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityResult] + 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.CheckNameAvailabilityResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PackageCheckNameAvailabilityParameters") @@ -1323,10 +1325,11 @@ async def check_package_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1343,4 +1346,6 @@ async def check_package_name_availability( return deserialized - check_package_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/checkPackageNameAvailability"} # type: ignore + check_package_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/checkPackageNameAvailability" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_results_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_results_operations.py index 29b345729ad6..3fa663517f8d 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_results_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_results_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -37,10 +37,6 @@ build_list_request, ) -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,15 +73,15 @@ def list( """Lists all the Test Results with specified OS Update type for a Test Base Package. Can be filtered by osName, releaseName, flightingRing, buildVersion, buildRevision. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str :param package_name: The resource name of the Test Base Package. Required. :type package_name: str - :param os_update_type: The type of the OS Update. Known values are: "SecurityUpdate" and - "FeatureUpdate". Required. + :param os_update_type: The type of the OS Update. Known values are: "SecurityUpdate", + "FeatureUpdate", and "InplaceUpgrade". Required. :type os_update_type: str or ~azure.mgmt.testbase.models.OsUpdateType :param filter: Odata filter. Default value is None. :type filter: str @@ -97,10 +93,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestResultListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestResultListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -126,7 +120,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -142,7 +136,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -150,14 +144,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TestResultListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -170,7 +165,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults" + } @distributed_trace_async async def get( @@ -183,7 +180,7 @@ async def get( ) -> _models.TestResultResource: """Get the Test Result by Id with specified OS Update type for a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -209,10 +206,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestResultResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestResultResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -226,10 +221,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,7 +242,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}" + } @distributed_trace_async async def get_download_url( @@ -259,7 +257,7 @@ async def get_download_url( ) -> _models.DownloadURLResponse: """Gets the download URL of the test result. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -285,10 +283,8 @@ async def get_download_url( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadURLResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DownloadURLResponse] = kwargs.pop("cls", None) request = build_get_download_url_request( resource_group_name=resource_group_name, @@ -302,10 +298,11 @@ async def get_download_url( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -322,7 +319,9 @@ async def get_download_url( return deserialized - get_download_url.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getDownloadUrl"} # type: ignore + get_download_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getDownloadUrl" + } @distributed_trace_async async def get_video_download_url( @@ -335,7 +334,7 @@ async def get_video_download_url( ) -> _models.DownloadURLResponse: """Gets the download URL of the test execution screen recording. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -361,10 +360,8 @@ async def get_video_download_url( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadURLResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DownloadURLResponse] = kwargs.pop("cls", None) request = build_get_video_download_url_request( resource_group_name=resource_group_name, @@ -378,10 +375,11 @@ async def get_video_download_url( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -398,7 +396,9 @@ async def get_video_download_url( return deserialized - get_video_download_url.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getVideoDownloadUrl"} # type: ignore + get_video_download_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getVideoDownloadUrl" + } @overload async def get_console_log_download_url( @@ -414,7 +414,7 @@ async def get_console_log_download_url( ) -> _models.DownloadURLResponse: """Gets the download URL of the test execution console log file. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -450,7 +450,7 @@ async def get_console_log_download_url( ) -> _models.DownloadURLResponse: """Gets the download URL of the test execution console log file. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -484,7 +484,7 @@ async def get_console_log_download_url( ) -> _models.DownloadURLResponse: """Gets the download URL of the test execution console log file. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -495,7 +495,7 @@ async def get_console_log_download_url( Required. :type test_result_name: str :param parameters: Parameters supplied to the Test Result GetConsoleLogDownloadUrl operation. - Is either a model type or a IO type. Required. + Is either a TestResultConsoleLogDownloadURLParameters type or a IO type. Required. :type parameters: ~azure.mgmt.testbase.models.TestResultConsoleLogDownloadURLParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -516,16 +516,14 @@ async def get_console_log_download_url( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadURLResponse] + 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.DownloadURLResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TestResultConsoleLogDownloadURLParameters") @@ -545,10 +543,11 @@ async def get_console_log_download_url( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -565,4 +564,6 @@ async def get_console_log_download_url( return deserialized - get_console_log_download_url.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getConsoleLogDownloadUrl"} # type: ignore + get_console_log_download_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getConsoleLogDownloadUrl" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_summaries_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_summaries_operations.py index 8c781136624c..3e7c53a64477 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_summaries_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_summaries_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._test_summaries_operations import build_get_request, build_list_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +59,7 @@ def list( ) -> AsyncIterable["_models.TestSummaryResource"]: """Lists the Test Summaries of all the packages under a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -78,10 +73,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestSummaryListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestSummaryListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -104,7 +97,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -120,7 +113,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -128,14 +121,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TestSummaryListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -148,7 +142,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testSummaries"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testSummaries" + } @distributed_trace_async async def get( @@ -157,7 +153,7 @@ async def get( """Gets a Test Summary with specific name from all the Test Summaries of all the packages under a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -180,10 +176,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestSummaryResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestSummaryResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -196,10 +190,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -216,4 +211,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testSummaries/{testSummaryName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testSummaries/{testSummaryName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_types_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_types_operations.py index 6ad08f284d2e..09fbd7db1d41 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_types_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_test_types_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -31,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._test_types_operations import build_get_request, build_list_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +59,7 @@ def list( ) -> AsyncIterable["_models.TestTypeResource"]: """Lists all the test types of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -77,10 +72,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestTypeListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestTypeListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +96,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +112,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,14 +120,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TestTypeListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -147,7 +141,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testTypes"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testTypes" + } @distributed_trace_async async def get( @@ -155,7 +151,7 @@ async def get( ) -> _models.TestTypeResource: """Gets a test type of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -178,10 +174,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestTypeResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestTypeResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -194,10 +188,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -214,4 +209,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testTypes/{testTypeResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testTypes/{testTypeResourceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_usage_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_usage_operations.py index f4b20017ced7..513adb8da9ad 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_usage_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_usage_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._usage_operations import build_list_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +58,7 @@ def list( ) -> AsyncIterable["_models.TestBaseAccountUsageData"]: """Lists the usage data of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -80,10 +75,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestBaseAccountUsageDataList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestBaseAccountUsageDataList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -107,7 +100,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -123,7 +116,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -131,14 +124,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("TestBaseAccountUsageDataList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,4 +145,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/usages"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/usages" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_vhds_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_vhds_operations.py new file mode 100644 index 000000000000..d5c28a1f469e --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/aio/operations/_vhds_operations.py @@ -0,0 +1,282 @@ +# pylint: disable=too-many-lines +# 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, AsyncIterable, Callable, Dict, Optional, TypeVar +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._vhds_operations import ( + build_delete_request, + build_get_request, + build_list_by_test_base_account_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class VHDsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.aio.TestBase`'s + :attr:`vhds` 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 + def list_by_test_base_account( + self, resource_group_name: str, test_base_account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.VHDResource"]: + """Lists all the VHDs under a test base account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VHDResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.testbase.models.VHDResource] + :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.VHDListResult] = 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_test_base_account_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_test_base_account.metadata["url"], + 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("VHDListResult", 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) + + list_by_test_base_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/vhds" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, test_base_account_name: str, vhd_name: str, **kwargs: Any + ) -> None: + """Deletes a Test Base VHD. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param vhd_name: The resource name of the Test Base VHD. Required. + :type vhd_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: + """ + 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, + test_base_account_name=test_base_account_name, + vhd_name=vhd_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) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/vhds/{vhdName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, test_base_account_name: str, vhd_name: str, **kwargs: Any + ) -> _models.VHDResource: + """Gets a Test Base VHD. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param vhd_name: The resource name of the Test Base VHD. Required. + :type vhd_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VHDResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.VHDResource + :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.VHDResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + vhd_name=vhd_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) + + _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("VHDResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/vhds/{vhdName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/__init__.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/__init__.py index 4b5fee7d6347..ca2ffedea251 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/__init__.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/__init__.py @@ -6,9 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models_py3 import ActionRequest +from ._models_py3 import ActionRequests from ._models_py3 import AnalysisResultListResult from ._models_py3 import AnalysisResultSingletonResource from ._models_py3 import AnalysisResultSingletonResourceProperties +from ._models_py3 import AnswerCitation +from ._models_py3 import AvailableInplaceUpgradeOSListResult +from ._models_py3 import AvailableInplaceUpgradeOSResource from ._models_py3 import AvailableOSListResult from ._models_py3 import AvailableOSResource from ._models_py3 import BillingHubExecutionUsageDetail @@ -22,23 +27,67 @@ from ._models_py3 import BillingHubUsageGroupedByUpdateType from ._models_py3 import CPURegressionResultSingletonResourceProperties from ._models_py3 import CPUUtilizationResultSingletonResourceProperties +from ._models_py3 import ChatRequest +from ._models_py3 import ChatResponse +from ._models_py3 import ChatSessionResource +from ._models_py3 import ChatSessionResourceListResult from ._models_py3 import CheckNameAvailabilityResult from ._models_py3 import Command +from ._models_py3 import CopyFromPackageOperationParameters +from ._models_py3 import CredentialListResult +from ._models_py3 import CredentialProperties +from ._models_py3 import CredentialResource +from ._models_py3 import CustomImageListResult +from ._models_py3 import CustomImageResource from ._models_py3 import CustomerEventListResult from ._models_py3 import CustomerEventResource from ._models_py3 import DistributionGroupListReceiverValue from ._models_py3 import DownloadURLResponse +from ._models_py3 import DraftPackageGetPathResponse +from ._models_py3 import DraftPackageIntuneAppMetadata +from ._models_py3 import DraftPackageIntuneAppMetadataItem +from ._models_py3 import DraftPackageListResult +from ._models_py3 import DraftPackageResource +from ._models_py3 import DraftPackageUpdateParameters from ._models_py3 import EmailEventListResult from ._models_py3 import EmailEventResource -from ._models_py3 import ErrorDefinition +from ._models_py3 import EnrolledIntuneApp +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse +from ._models_py3 import ExtractFileOperationParameters from ._models_py3 import FavoriteProcessListResult from ._models_py3 import FavoriteProcessResource +from ._models_py3 import FeatureUpdateSupportedOsesResource +from ._models_py3 import FeatureUpdateSupportedOsesResult from ._models_py3 import FileUploadURLResponse +from ._models_py3 import FirstPartyAppDefinition +from ._models_py3 import FirstPartyAppListResult +from ._models_py3 import FirstPartyAppResource from ._models_py3 import FlightingRingListResult from ._models_py3 import FlightingRingResource +from ._models_py3 import FreeHourBalanceResource +from ._models_py3 import FreeHourBalancesListResult +from ._models_py3 import GalleryAppDefinition +from ._models_py3 import GalleryAppListResult +from ._models_py3 import GalleryAppResource +from ._models_py3 import GalleryAppSkuListResult +from ._models_py3 import GalleryAppSkuProperties +from ._models_py3 import GalleryAppSkuResource +from ._models_py3 import GenerateOperationParameters from ._models_py3 import GetFileUploadURLParameters +from ._models_py3 import GetImageDefinitionParameters +from ._models_py3 import HighlightedFile from ._models_py3 import IdentifiedFailure +from ._models_py3 import ImageDefinitionListResult +from ._models_py3 import ImageDefinitionResource +from ._models_py3 import ImageDefinitionsListResult +from ._models_py3 import ImageNameCheckAvailabilityParameters +from ._models_py3 import ImageValidationResults +from ._models_py3 import InplaceUpgradeOSInfo +from ._models_py3 import InplaceUpgradeProperties +from ._models_py3 import IntuneEnrollmentMetadata +from ._models_py3 import IntuneSingletonResourceProperties from ._models_py3 import MemoryRegressionResultSingletonResourceProperties from ._models_py3 import MemoryUtilizationResultSingletonResourceProperties from ._models_py3 import NotificationEventReceiver @@ -50,22 +99,27 @@ from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult +from ._models_py3 import OsProperties from ._models_py3 import PackageCheckNameAvailabilityParameters from ._models_py3 import PackageListResult from ._models_py3 import PackageResource from ._models_py3 import PackageRunTestParameters from ._models_py3 import PackageUpdateParameters from ._models_py3 import PackageValidationResult +from ._models_py3 import PreReleaseAccessRequestSpec from ._models_py3 import ProxyResource from ._models_py3 import RegressionResult from ._models_py3 import RegressionTestDetails +from ._models_py3 import ReleaseProperties from ._models_py3 import ReliabilityResult from ._models_py3 import ReliabilityResultSingletonResourceProperties from ._models_py3 import Resource from ._models_py3 import ScriptExecutionResult from ._models_py3 import ScriptExecutionResultSingletonResourceProperties from ._models_py3 import SubscriptionReceiverValue +from ._models_py3 import SystemAssignedServiceIdentity from ._models_py3 import SystemData +from ._models_py3 import TabState from ._models_py3 import TargetOSInfo from ._models_py3 import Test from ._models_py3 import TestAnalysisResult @@ -81,6 +135,7 @@ from ._models_py3 import TestBaseAccountUsageName from ._models_py3 import TestResultAnalysisSummary from ._models_py3 import TestResultConsoleLogDownloadURLParameters +from ._models_py3 import TestResultFirstPartyAppDefinition from ._models_py3 import TestResultListResult from ._models_py3 import TestResultResource from ._models_py3 import TestSummaryListResult @@ -92,34 +147,70 @@ from ._models_py3 import UtilizationBound from ._models_py3 import UtilizationEntry from ._models_py3 import UtilizationResult +from ._models_py3 import VHDListResult +from ._models_py3 import VHDResource +from ._models_py3 import VerificationResult +from ._models_py3 import WingetAppSkuProperties from ._test_base_enums import Action +from ._test_base_enums import ActionType from ._test_base_enums import AnalysisResultName from ._test_base_enums import AnalysisResultType from ._test_base_enums import AnalysisStatus +from ._test_base_enums import ApplicationType +from ._test_base_enums import Architecture from ._test_base_enums import Category from ._test_base_enums import ContentType from ._test_base_enums import CreatedByType +from ._test_base_enums import CredentialType +from ._test_base_enums import DraftPackageSourceType +from ._test_base_enums import Engagements from ._test_base_enums import ExecutionStatus +from ._test_base_enums import ExtractFileType +from ._test_base_enums import FileUploadResourceType +from ._test_base_enums import FreeHourBalanceName +from ._test_base_enums import FreeHourStatus +from ._test_base_enums import FreeHourType from ._test_base_enums import Grade +from ._test_base_enums import ImageArchitecture +from ._test_base_enums import ImageOSState +from ._test_base_enums import ImageSecurityType +from ._test_base_enums import ImageSource +from ._test_base_enums import ImageStatus +from ._test_base_enums import InteropExecutionMode +from ._test_base_enums import IntuneExtractStatus +from ._test_base_enums import OrderBy +from ._test_base_enums import Origin +from ._test_base_enums import OsProductState from ._test_base_enums import OsUpdateType from ._test_base_enums import PackageStatus +from ._test_base_enums import PackageStudioTabs from ._test_base_enums import ProvisioningState from ._test_base_enums import Reason +from ._test_base_enums import RequestStatus +from ._test_base_enums import RequestTypes +from ._test_base_enums import SystemAssignedServiceIdentityType from ._test_base_enums import TestAnalysisStatus from ._test_base_enums import TestStatus from ._test_base_enums import TestType from ._test_base_enums import Tier from ._test_base_enums import Type +from ._test_base_enums import VHDStatus from ._test_base_enums import ValidationRunStatus +from ._test_base_enums import VerificationStatus from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "ActionRequest", + "ActionRequests", "AnalysisResultListResult", "AnalysisResultSingletonResource", "AnalysisResultSingletonResourceProperties", + "AnswerCitation", + "AvailableInplaceUpgradeOSListResult", + "AvailableInplaceUpgradeOSResource", "AvailableOSListResult", "AvailableOSResource", "BillingHubExecutionUsageDetail", @@ -133,23 +224,67 @@ "BillingHubUsageGroupedByUpdateType", "CPURegressionResultSingletonResourceProperties", "CPUUtilizationResultSingletonResourceProperties", + "ChatRequest", + "ChatResponse", + "ChatSessionResource", + "ChatSessionResourceListResult", "CheckNameAvailabilityResult", "Command", + "CopyFromPackageOperationParameters", + "CredentialListResult", + "CredentialProperties", + "CredentialResource", + "CustomImageListResult", + "CustomImageResource", "CustomerEventListResult", "CustomerEventResource", "DistributionGroupListReceiverValue", "DownloadURLResponse", + "DraftPackageGetPathResponse", + "DraftPackageIntuneAppMetadata", + "DraftPackageIntuneAppMetadataItem", + "DraftPackageListResult", + "DraftPackageResource", + "DraftPackageUpdateParameters", "EmailEventListResult", "EmailEventResource", - "ErrorDefinition", + "EnrolledIntuneApp", + "ErrorAdditionalInfo", + "ErrorDetail", "ErrorResponse", + "ExtractFileOperationParameters", "FavoriteProcessListResult", "FavoriteProcessResource", + "FeatureUpdateSupportedOsesResource", + "FeatureUpdateSupportedOsesResult", "FileUploadURLResponse", + "FirstPartyAppDefinition", + "FirstPartyAppListResult", + "FirstPartyAppResource", "FlightingRingListResult", "FlightingRingResource", + "FreeHourBalanceResource", + "FreeHourBalancesListResult", + "GalleryAppDefinition", + "GalleryAppListResult", + "GalleryAppResource", + "GalleryAppSkuListResult", + "GalleryAppSkuProperties", + "GalleryAppSkuResource", + "GenerateOperationParameters", "GetFileUploadURLParameters", + "GetImageDefinitionParameters", + "HighlightedFile", "IdentifiedFailure", + "ImageDefinitionListResult", + "ImageDefinitionResource", + "ImageDefinitionsListResult", + "ImageNameCheckAvailabilityParameters", + "ImageValidationResults", + "InplaceUpgradeOSInfo", + "InplaceUpgradeProperties", + "IntuneEnrollmentMetadata", + "IntuneSingletonResourceProperties", "MemoryRegressionResultSingletonResourceProperties", "MemoryUtilizationResultSingletonResourceProperties", "NotificationEventReceiver", @@ -161,22 +296,27 @@ "Operation", "OperationDisplay", "OperationListResult", + "OsProperties", "PackageCheckNameAvailabilityParameters", "PackageListResult", "PackageResource", "PackageRunTestParameters", "PackageUpdateParameters", "PackageValidationResult", + "PreReleaseAccessRequestSpec", "ProxyResource", "RegressionResult", "RegressionTestDetails", + "ReleaseProperties", "ReliabilityResult", "ReliabilityResultSingletonResourceProperties", "Resource", "ScriptExecutionResult", "ScriptExecutionResultSingletonResourceProperties", "SubscriptionReceiverValue", + "SystemAssignedServiceIdentity", "SystemData", + "TabState", "TargetOSInfo", "Test", "TestAnalysisResult", @@ -192,6 +332,7 @@ "TestBaseAccountUsageName", "TestResultAnalysisSummary", "TestResultConsoleLogDownloadURLParameters", + "TestResultFirstPartyAppDefinition", "TestResultListResult", "TestResultResource", "TestSummaryListResult", @@ -203,25 +344,56 @@ "UtilizationBound", "UtilizationEntry", "UtilizationResult", + "VHDListResult", + "VHDResource", + "VerificationResult", + "WingetAppSkuProperties", "Action", + "ActionType", "AnalysisResultName", "AnalysisResultType", "AnalysisStatus", + "ApplicationType", + "Architecture", "Category", "ContentType", "CreatedByType", + "CredentialType", + "DraftPackageSourceType", + "Engagements", "ExecutionStatus", + "ExtractFileType", + "FileUploadResourceType", + "FreeHourBalanceName", + "FreeHourStatus", + "FreeHourType", "Grade", + "ImageArchitecture", + "ImageOSState", + "ImageSecurityType", + "ImageSource", + "ImageStatus", + "InteropExecutionMode", + "IntuneExtractStatus", + "OrderBy", + "Origin", + "OsProductState", "OsUpdateType", "PackageStatus", + "PackageStudioTabs", "ProvisioningState", "Reason", + "RequestStatus", + "RequestTypes", + "SystemAssignedServiceIdentityType", "TestAnalysisStatus", "TestStatus", "TestType", "Tier", "Type", + "VHDStatus", "ValidationRunStatus", + "VerificationStatus", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_models_py3.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_models_py3.py index d52b5eac5fe1..3fe054055b86 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_models_py3.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_models_py3.py @@ -8,114 +8,234 @@ # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object -class AnalysisResultListResult(_serialization.Model): - """A list of Analysis Results. It will only contain one element as all the data will be nested in a singleton object. +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of Analysis Results. - :vartype value: list[~azure.mgmt.testbase.models.AnalysisResultSingletonResource] - :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list - of results. - :vartype next_link: str + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :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.testbase.models.SystemData """ _validation = { - "next_link": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[AnalysisResultSingletonResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, *, value: Optional[List["_models.AnalysisResultSingletonResource"]] = None, **kwargs): - """ - :keyword value: The list of Analysis Results. - :paramtype value: list[~azure.mgmt.testbase.models.AnalysisResultSingletonResource] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.value = value - self.next_link = None + self.id = None + self.name = None + self.type = None + self.system_data = None -class Resource(_serialization.Model): - """The Resource definition. +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :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.testbase.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): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None -class ProxyResource(Resource): - """The resource model definition for an ARM proxy resource. It will have everything other than required location and tags. +class ActionRequest(ProxyResource): + """ActionRequest. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :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.testbase.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.testbase.models.ProvisioningState + :ivar request_type: "PreReleaseAccess" + :vartype request_type: str or ~azure.mgmt.testbase.models.RequestTypes + :ivar pre_release_access_request_spec: + :vartype pre_release_access_request_spec: + ~azure.mgmt.testbase.models.PreReleaseAccessRequestSpec + :ivar creation_date: + :vartype creation_date: ~datetime.datetime + :ivar status: Known values are: "InReview", "Approved", and "Declined". + :vartype status: str or ~azure.mgmt.testbase.models.RequestStatus """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "creation_date": {"readonly": True}, + "status": {"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"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "request_type": {"key": "properties.requestType", "type": "str"}, + "pre_release_access_request_spec": { + "key": "properties.preReleaseAccessRequestSpec", + "type": "PreReleaseAccessRequestSpec", + }, + "creation_date": {"key": "properties.creationDate", "type": "iso-8601"}, + "status": {"key": "properties.status", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__( + self, + *, + request_type: Optional[Union[str, "_models.RequestTypes"]] = None, + pre_release_access_request_spec: Optional["_models.PreReleaseAccessRequestSpec"] = None, + **kwargs: Any + ) -> None: + """ + :keyword request_type: "PreReleaseAccess" + :paramtype request_type: str or ~azure.mgmt.testbase.models.RequestTypes + :keyword pre_release_access_request_spec: + :paramtype pre_release_access_request_spec: + ~azure.mgmt.testbase.models.PreReleaseAccessRequestSpec + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.request_type = request_type + self.pre_release_access_request_spec = pre_release_access_request_spec + self.creation_date = None + self.status = None + + +class ActionRequests(_serialization.Model): + """ActionRequests. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: + :vartype value: list[~azure.mgmt.testbase.models.ActionRequest] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ActionRequest]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ActionRequest"]] = None, **kwargs: Any) -> None: + """ + :keyword value: + :paramtype value: list[~azure.mgmt.testbase.models.ActionRequest] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class AnalysisResultListResult(_serialization.Model): + """A list of Analysis Results. It will only contain one element as all the data will be nested in + a singleton object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of Analysis Results. + :vartype value: list[~azure.mgmt.testbase.models.AnalysisResultSingletonResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AnalysisResultSingletonResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.AnalysisResultSingletonResource"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of Analysis Results. + :paramtype value: list[~azure.mgmt.testbase.models.AnalysisResultSingletonResource] + """ super().__init__(**kwargs) + self.value = value + self.next_link = None class AnalysisResultSingletonResource(ProxyResource): @@ -123,16 +243,19 @@ class AnalysisResultSingletonResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system metadata relating to this resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.testbase.models.SystemData - :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", "Fail", + and "Pass". :vartype grade: str or ~azure.mgmt.testbase.models.Grade :ivar analysis_result_type: Type of the Analysis Result. Known values are: "ScriptExecution", "Reliability", "CPUUtilization", "MemoryUtilization", "CPURegression", "MemoryRegression", and @@ -156,16 +279,15 @@ class AnalysisResultSingletonResource(ProxyResource): "analysis_result_type": {"key": "properties.analysisResultType", "type": "str"}, } - def __init__(self, *, grade: Optional[Union[str, "_models.Grade"]] = None, **kwargs): + def __init__(self, *, grade: Optional[Union[str, "_models.Grade"]] = None, **kwargs: Any) -> None: """ - :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", + "Fail", and "Pass". :paramtype grade: str or ~azure.mgmt.testbase.models.Grade """ super().__init__(**kwargs) - self.system_data = None self.grade = grade - self.analysis_result_type = None # type: Optional[str] + self.analysis_result_type: Optional[str] = None class AnalysisResultSingletonResourceProperties(_serialization.Model): @@ -181,8 +303,8 @@ class AnalysisResultSingletonResourceProperties(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", "Fail", + and "Pass". :vartype grade: str or ~azure.mgmt.testbase.models.Grade :ivar analysis_result_type: Type of the Analysis Result. Required. Known values are: "ScriptExecution", "Reliability", "CPUUtilization", "MemoryUtilization", "CPURegression", @@ -211,15 +333,160 @@ class AnalysisResultSingletonResourceProperties(_serialization.Model): } } - def __init__(self, *, grade: Optional[Union[str, "_models.Grade"]] = None, **kwargs): + def __init__(self, *, grade: Optional[Union[str, "_models.Grade"]] = None, **kwargs: Any) -> None: """ - :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", + "Fail", and "Pass". :paramtype grade: str or ~azure.mgmt.testbase.models.Grade """ super().__init__(**kwargs) self.grade = grade - self.analysis_result_type = None # type: Optional[str] + self.analysis_result_type: Optional[str] = None + + +class AnswerCitation(_serialization.Model): + """The answer citation. + + :ivar title: The title of the citation. + :vartype title: str + :ivar url: The url of the citation. + :vartype url: str + :ivar chunk_index: The chunk index of the content. + :vartype chunk_index: int + """ + + _attribute_map = { + "title": {"key": "title", "type": "str"}, + "url": {"key": "url", "type": "str"}, + "chunk_index": {"key": "chunkIndex", "type": "int"}, + } + + def __init__( + self, + *, + title: Optional[str] = None, + url: Optional[str] = None, + chunk_index: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword title: The title of the citation. + :paramtype title: str + :keyword url: The url of the citation. + :paramtype url: str + :keyword chunk_index: The chunk index of the content. + :paramtype chunk_index: int + """ + super().__init__(**kwargs) + self.title = title + self.url = url + self.chunk_index = chunk_index + + +class AvailableInplaceUpgradeOSListResult(_serialization.Model): + """A list of available In-place Upgrade OSs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of available In-place Upgrade OS. + :vartype value: list[~azure.mgmt.testbase.models.AvailableInplaceUpgradeOSResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AvailableInplaceUpgradeOSResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.AvailableInplaceUpgradeOSResource"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of available In-place Upgrade OS. + :paramtype value: list[~azure.mgmt.testbase.models.AvailableInplaceUpgradeOSResource] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class AvailableInplaceUpgradeOSResource(ProxyResource): + """The Available In-place Upgrade OS Map 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :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.testbase.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.testbase.models.ProvisioningState + :ivar source_os_name: The name of an Available In-place Upgrade source OS of a Test Base + Account. + :vartype source_os_name: str + :ivar source_os_releases: The the release list of the source os. + :vartype source_os_releases: list[~azure.mgmt.testbase.models.ReleaseProperties] + :ivar supported_target_os_name_list: The list of the corresponding Available In-place Upgrade + target OS name of a Test Base Account. + :vartype supported_target_os_name_list: list[str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"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"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "source_os_name": {"key": "properties.sourceOsName", "type": "str"}, + "source_os_releases": {"key": "properties.sourceOsReleases", "type": "[ReleaseProperties]"}, + "supported_target_os_name_list": {"key": "properties.supportedTargetOsNameList", "type": "[str]"}, + } + + def __init__( + self, + *, + source_os_name: Optional[str] = None, + source_os_releases: Optional[List["_models.ReleaseProperties"]] = None, + supported_target_os_name_list: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword source_os_name: The name of an Available In-place Upgrade source OS of a Test Base + Account. + :paramtype source_os_name: str + :keyword source_os_releases: The the release list of the source os. + :paramtype source_os_releases: list[~azure.mgmt.testbase.models.ReleaseProperties] + :keyword supported_target_os_name_list: The list of the corresponding Available In-place + Upgrade target OS name of a Test Base Account. + :paramtype supported_target_os_name_list: list[str] + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.source_os_name = source_os_name + self.source_os_releases = source_os_releases + self.supported_target_os_name_list = supported_target_os_name_list class AvailableOSListResult(_serialization.Model): @@ -243,7 +510,7 @@ class AvailableOSListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.AvailableOSResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.AvailableOSResource"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of available OSs. :paramtype value: list[~azure.mgmt.testbase.models.AvailableOSResource] @@ -258,13 +525,16 @@ class AvailableOSResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system metadata relating to this resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.testbase.models.SystemData :ivar os_id: The Id of an Available OS of a Test Base Account. :vartype os_id: str @@ -309,8 +579,8 @@ def __init__( insider_channel: Optional[str] = None, os_update_type: Optional[str] = None, os_platform: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword os_id: The Id of an Available OS of a Test Base Account. :paramtype os_id: str @@ -326,7 +596,6 @@ def __init__( :paramtype os_platform: str """ super().__init__(**kwargs) - self.system_data = None self.os_id = os_id self.os_name = os_name self.os_version = os_version @@ -402,8 +671,8 @@ def __init__( used_free_hours: Optional[float] = None, used_billable_hours: Optional[float] = None, billed_charges: Optional[float] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword application_name: :paramtype application_name: str @@ -454,6 +723,10 @@ def __init__( class BillingHubFreeHourIncrementEntry(_serialization.Model): """BillingHubFreeHourIncrementEntry. + :ivar free_hour_type: Known values are: "Permanent" and "Temporary". + :vartype free_hour_type: str or ~azure.mgmt.testbase.models.FreeHourType + :ivar free_hour_status: Known values are: "Enabled" and "Suspended". + :vartype free_hour_status: str or ~azure.mgmt.testbase.models.FreeHourStatus :ivar create_time_stamp: :vartype create_time_stamp: ~datetime.datetime :ivar expiration_time_stamp: @@ -465,6 +738,8 @@ class BillingHubFreeHourIncrementEntry(_serialization.Model): """ _attribute_map = { + "free_hour_type": {"key": "freeHourType", "type": "str"}, + "free_hour_status": {"key": "freeHourStatus", "type": "str"}, "create_time_stamp": {"key": "createTimeStamp", "type": "iso-8601"}, "expiration_time_stamp": {"key": "expirationTimeStamp", "type": "iso-8601"}, "incremental_free_hours": {"key": "incrementalFreeHours", "type": "float"}, @@ -474,13 +749,19 @@ class BillingHubFreeHourIncrementEntry(_serialization.Model): def __init__( self, *, + free_hour_type: Optional[Union[str, "_models.FreeHourType"]] = None, + free_hour_status: Optional[Union[str, "_models.FreeHourStatus"]] = None, create_time_stamp: Optional[datetime.datetime] = None, expiration_time_stamp: Optional[datetime.datetime] = None, incremental_free_hours: Optional[float] = None, remaining_free_hours: Optional[float] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ + :keyword free_hour_type: Known values are: "Permanent" and "Temporary". + :paramtype free_hour_type: str or ~azure.mgmt.testbase.models.FreeHourType + :keyword free_hour_status: Known values are: "Enabled" and "Suspended". + :paramtype free_hour_status: str or ~azure.mgmt.testbase.models.FreeHourStatus :keyword create_time_stamp: :paramtype create_time_stamp: ~datetime.datetime :keyword expiration_time_stamp: @@ -491,6 +772,8 @@ def __init__( :paramtype remaining_free_hours: float """ super().__init__(**kwargs) + self.free_hour_type = free_hour_type + self.free_hour_status = free_hour_status self.create_time_stamp = create_time_stamp self.expiration_time_stamp = expiration_time_stamp self.incremental_free_hours = incremental_free_hours @@ -516,8 +799,8 @@ def __init__( *, total_remaining_free_hours: Optional[float] = None, increment_entries: Optional[List["_models.BillingHubFreeHourIncrementEntry"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword total_remaining_free_hours: :paramtype total_remaining_free_hours: float @@ -564,8 +847,8 @@ def __init__( end_time_stamp: datetime.datetime, page_size: Optional[int] = None, page_index: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword start_time_stamp: Required. :paramtype start_time_stamp: ~datetime.datetime @@ -614,8 +897,8 @@ def __init__( total_charges: Optional[float] = None, package_usage_entries: Optional[List["_models.BillingHubPackageUsage"]] = None, next_request: Optional["_models.BillingHubGetUsageRequest"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword total_used_free_hours: :paramtype total_used_free_hours: float @@ -679,8 +962,8 @@ def __init__( total_used_billable_hours: Optional[float] = None, total_charges: Optional[float] = None, usage_entries_grouped_by_update_type: Optional[List["_models.BillingHubUsageGroupedByUpdateType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword application_name: :paramtype application_name: str @@ -747,8 +1030,8 @@ def __init__( total_used_billable_hours: Optional[float] = None, total_charges: Optional[float] = None, usage_groups: Optional[List["_models.BillingHubUsageGroup"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword application_name: :paramtype application_name: str @@ -831,8 +1114,8 @@ def __init__( test_type: Optional[str] = None, product_family: Optional[str] = None, execution_usage_details: Optional[List["_models.BillingHubExecutionUsageDetail"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword total_used_free_hours: :paramtype total_used_free_hours: float @@ -903,8 +1186,8 @@ def __init__( total_used_billable_hours: Optional[float] = None, total_charges: Optional[float] = None, usage_groups: Optional[List["_models.BillingHubUsageGroup"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword update_type: :paramtype update_type: str @@ -925,100 +1208,272 @@ def __init__( self.usage_groups = usage_groups -class CheckNameAvailabilityResult(_serialization.Model): - """Description of a Check Name availability response properties. +class ChatRequest(_serialization.Model): + """The chat request payload. - 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. - :ivar name_available: Value indicating the availability of the name: true if the name is - available; otherwise, false. - :vartype name_available: bool - :ivar reason: The reason for unavailability of a name. Required if nameAvailable == false. - Known values are: "Invalid" and "AlreadyExists". - :vartype reason: str or ~azure.mgmt.testbase.models.Reason - :ivar message: The detailed info regarding the reason associated with the name. Required if - nameAvailable == false. - :vartype message: str + :ivar question: The question of the chat turn. Required. + :vartype question: str """ _validation = { - "message": {"readonly": True}, + "question": {"required": True}, } _attribute_map = { - "name_available": {"key": "nameAvailable", "type": "bool"}, - "reason": {"key": "reason", "type": "str"}, - "message": {"key": "message", "type": "str"}, + "question": {"key": "question", "type": "str"}, } - def __init__( - self, *, name_available: Optional[bool] = None, reason: Optional[Union[str, "_models.Reason"]] = None, **kwargs - ): + def __init__(self, *, question: str, **kwargs: Any) -> None: """ - :keyword name_available: Value indicating the availability of the name: true if the name is - available; otherwise, false. - :paramtype name_available: bool - :keyword reason: The reason for unavailability of a name. Required if nameAvailable == false. - Known values are: "Invalid" and "AlreadyExists". - :paramtype reason: str or ~azure.mgmt.testbase.models.Reason + :keyword question: The question of the chat turn. Required. + :paramtype question: str """ super().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = None + self.question = question -class Command(_serialization.Model): - """The command used in the test. +class ChatResponse(_serialization.Model): + """The chat response payload. + + 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. - :ivar name: The name of the command. Required. - :vartype name: str - :ivar action: The action of the command. Required. Known values are: "Install", "Launch", - "Close", "Uninstall", and "Custom". - :vartype action: str or ~azure.mgmt.testbase.models.Action - :ivar content_type: The type of command content. Required. Known values are: "Inline", "File", - and "Path". - :vartype content_type: str or ~azure.mgmt.testbase.models.ContentType - :ivar content: The content of the command. The content depends on source type. Required. - :vartype content: str - :ivar run_elevated: Specifies whether to run the command as administrator. - :vartype run_elevated: bool - :ivar restart_after: Specifies whether to restart the VM after the command executed. - :vartype restart_after: bool - :ivar max_run_time: Specifies the max run time of the command. - :vartype max_run_time: int - :ivar run_as_interactive: Specifies whether to run the command in interactive mode. - :vartype run_as_interactive: bool - :ivar always_run: Specifies whether to run the command even if a previous command is failed. - :vartype always_run: bool - :ivar apply_update_before: Specifies whether to apply update before the command. - :vartype apply_update_before: bool + :ivar question: The question from the request. Required. + :vartype question: str + :ivar answer: The answer from the system. Required. + :vartype answer: str + :ivar citations: + :vartype citations: list[~azure.mgmt.testbase.models.AnswerCitation] + :ivar usage: The usage of questions within the chat session. Required. + :vartype usage: int + :ivar limit: The limit of questions within the chat session. Required. + :vartype limit: int """ _validation = { - "name": {"required": True}, - "action": {"required": True}, - "content_type": {"required": True}, - "content": {"required": True}, + "question": {"required": True}, + "answer": {"required": True}, + "usage": {"required": True, "readonly": True}, + "limit": {"required": True, "readonly": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "action": {"key": "action", "type": "str"}, - "content_type": {"key": "contentType", "type": "str"}, - "content": {"key": "content", "type": "str"}, - "run_elevated": {"key": "runElevated", "type": "bool"}, - "restart_after": {"key": "restartAfter", "type": "bool"}, - "max_run_time": {"key": "maxRunTime", "type": "int"}, - "run_as_interactive": {"key": "runAsInteractive", "type": "bool"}, - "always_run": {"key": "alwaysRun", "type": "bool"}, - "apply_update_before": {"key": "applyUpdateBefore", "type": "bool"}, + "question": {"key": "properties.question", "type": "str"}, + "answer": {"key": "properties.answer", "type": "str"}, + "citations": {"key": "properties.citations", "type": "[AnswerCitation]"}, + "usage": {"key": "properties.usage", "type": "int"}, + "limit": {"key": "properties.limit", "type": "int"}, } def __init__( - self, + self, *, question: str, answer: str, citations: Optional[List["_models.AnswerCitation"]] = None, **kwargs: Any + ) -> None: + """ + :keyword question: The question from the request. Required. + :paramtype question: str + :keyword answer: The answer from the system. Required. + :paramtype answer: str + :keyword citations: + :paramtype citations: list[~azure.mgmt.testbase.models.AnswerCitation] + """ + super().__init__(**kwargs) + self.question = question + self.answer = answer + self.citations = citations + self.usage = None + self.limit = None + + +class ChatSessionResource(ProxyResource): + """The chat session 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :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.testbase.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.testbase.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"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"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_state = None + + +class ChatSessionResourceListResult(_serialization.Model): + """A list of chat session. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of chat session. + :vartype value: list[~azure.mgmt.testbase.models.ChatSessionResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ChatSessionResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ChatSessionResource"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of chat session. + :paramtype value: list[~azure.mgmt.testbase.models.ChatSessionResource] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class CheckNameAvailabilityResult(_serialization.Model): + """Description of a Check Name availability response properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: Value indicating the availability of the name: true if the name is + available; otherwise, false. + :vartype name_available: bool + :ivar reason: The reason for unavailability of a name. Required if nameAvailable == false. + Known values are: "Invalid" and "AlreadyExists". + :vartype reason: str or ~azure.mgmt.testbase.models.Reason + :ivar message: The detailed info regarding the reason associated with the name. Required if + nameAvailable == false. + :vartype message: str + """ + + _validation = { + "message": {"readonly": True}, + } + + _attribute_map = { + "name_available": {"key": "nameAvailable", "type": "bool"}, + "reason": {"key": "reason", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "_models.Reason"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name_available: Value indicating the availability of the name: true if the name is + available; otherwise, false. + :paramtype name_available: bool + :keyword reason: The reason for unavailability of a name. Required if nameAvailable == false. + Known values are: "Invalid" and "AlreadyExists". + :paramtype reason: str or ~azure.mgmt.testbase.models.Reason + """ + super().__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = None + + +class Command(_serialization.Model): # pylint: disable=too-many-instance-attributes + """The command used in the test. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The name of the command. Required. + :vartype name: str + :ivar action: The action of the command. Required. Known values are: "Install", "Launch", + "Close", "Uninstall", "Custom", and "FlowDrivenCustom". + :vartype action: str or ~azure.mgmt.testbase.models.Action + :ivar content_type: The type of command content. Required. Known values are: "Inline", "File", + and "Path". + :vartype content_type: str or ~azure.mgmt.testbase.models.ContentType + :ivar content: The content of the command. The content depends on source type. Required. + :vartype content: str + :ivar run_elevated: Specifies whether to run the command as administrator. + :vartype run_elevated: bool + :ivar restart_after: Specifies whether to restart the VM after the command executed. + :vartype restart_after: bool + :ivar max_run_time: Specifies the max run time of the command. + :vartype max_run_time: int + :ivar run_as_interactive: Specifies whether to run the command in interactive mode. + :vartype run_as_interactive: bool + :ivar always_run: Specifies whether to run the command even if a previous command is failed. + :vartype always_run: bool + :ivar apply_update_before: Specifies whether to apply update before the command. + :vartype apply_update_before: bool + :ivar install1_p_app_before: Specifies whether to install first party applications before + running the command. + :vartype install1_p_app_before: bool + :ivar pre_upgrade: Specifies whether the command is assigned to be executed before in-place + upgrade. + :vartype pre_upgrade: bool + :ivar post_upgrade: Specifies whether the command is assigned to be executed after in-place + upgrade. + :vartype post_upgrade: bool + :ivar enroll_intune_before: Specifies whether to enroll Intune before the command. + :vartype enroll_intune_before: bool + """ + + _validation = { + "name": {"required": True}, + "action": {"required": True}, + "content_type": {"required": True}, + "content": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "action": {"key": "action", "type": "str"}, + "content_type": {"key": "contentType", "type": "str"}, + "content": {"key": "content", "type": "str"}, + "run_elevated": {"key": "runElevated", "type": "bool"}, + "restart_after": {"key": "restartAfter", "type": "bool"}, + "max_run_time": {"key": "maxRunTime", "type": "int"}, + "run_as_interactive": {"key": "runAsInteractive", "type": "bool"}, + "always_run": {"key": "alwaysRun", "type": "bool"}, + "apply_update_before": {"key": "applyUpdateBefore", "type": "bool"}, + "install1_p_app_before": {"key": "install1PAppBefore", "type": "bool"}, + "pre_upgrade": {"key": "preUpgrade", "type": "bool"}, + "post_upgrade": {"key": "postUpgrade", "type": "bool"}, + "enroll_intune_before": {"key": "enrollIntuneBefore", "type": "bool"}, + } + + def __init__( + self, *, name: str, action: Union[str, "_models.Action"], @@ -1030,13 +1485,17 @@ def __init__( run_as_interactive: Optional[bool] = None, always_run: Optional[bool] = None, apply_update_before: Optional[bool] = None, - **kwargs - ): + install1_p_app_before: Optional[bool] = None, + pre_upgrade: Optional[bool] = None, + post_upgrade: Optional[bool] = None, + enroll_intune_before: Optional[bool] = None, + **kwargs: Any + ) -> None: """ :keyword name: The name of the command. Required. :paramtype name: str :keyword action: The action of the command. Required. Known values are: "Install", "Launch", - "Close", "Uninstall", and "Custom". + "Close", "Uninstall", "Custom", and "FlowDrivenCustom". :paramtype action: str or ~azure.mgmt.testbase.models.Action :keyword content_type: The type of command content. Required. Known values are: "Inline", "File", and "Path". @@ -1055,6 +1514,17 @@ def __init__( :paramtype always_run: bool :keyword apply_update_before: Specifies whether to apply update before the command. :paramtype apply_update_before: bool + :keyword install1_p_app_before: Specifies whether to install first party applications before + running the command. + :paramtype install1_p_app_before: bool + :keyword pre_upgrade: Specifies whether the command is assigned to be executed before in-place + upgrade. + :paramtype pre_upgrade: bool + :keyword post_upgrade: Specifies whether the command is assigned to be executed after in-place + upgrade. + :paramtype post_upgrade: bool + :keyword enroll_intune_before: Specifies whether to enroll Intune before the command. + :paramtype enroll_intune_before: bool """ super().__init__(**kwargs) self.name = name @@ -1067,6 +1537,36 @@ def __init__( self.run_as_interactive = run_as_interactive self.always_run = always_run self.apply_update_before = apply_update_before + self.install1_p_app_before = install1_p_app_before + self.pre_upgrade = pre_upgrade + self.post_upgrade = post_upgrade + self.enroll_intune_before = enroll_intune_before + + +class CopyFromPackageOperationParameters(_serialization.Model): + """Parameters body to pass to copy-from-package operation of Draft Package. + + All required parameters must be populated in order to send to Azure. + + :ivar package_id: The id of the package to copy from. Required. + :vartype package_id: str + """ + + _validation = { + "package_id": {"required": True}, + } + + _attribute_map = { + "package_id": {"key": "packageId", "type": "str"}, + } + + def __init__(self, *, package_id: str, **kwargs: Any) -> None: + """ + :keyword package_id: The id of the package to copy from. Required. + :paramtype package_id: str + """ + super().__init__(**kwargs) + self.package_id = package_id class CPURegressionResultSingletonResourceProperties(AnalysisResultSingletonResourceProperties): @@ -1074,8 +1574,8 @@ class CPURegressionResultSingletonResourceProperties(AnalysisResultSingletonReso All required parameters must be populated in order to send to Azure. - :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", "Fail", + and "Pass". :vartype grade: str or ~azure.mgmt.testbase.models.Grade :ivar analysis_result_type: Type of the Analysis Result. Required. Known values are: "ScriptExecution", "Reliability", "CPUUtilization", "MemoryUtilization", "CPURegression", @@ -1100,17 +1600,17 @@ def __init__( *, grade: Optional[Union[str, "_models.Grade"]] = None, cpu_regression_results: Optional[List["_models.RegressionResult"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", + "Fail", and "Pass". :paramtype grade: str or ~azure.mgmt.testbase.models.Grade :keyword cpu_regression_results: The result array data. :paramtype cpu_regression_results: list[~azure.mgmt.testbase.models.RegressionResult] """ super().__init__(grade=grade, **kwargs) - self.analysis_result_type = "CPURegression" # type: str + self.analysis_result_type: str = "CPURegression" self.cpu_regression_results = cpu_regression_results @@ -1119,8 +1619,8 @@ class CPUUtilizationResultSingletonResourceProperties(AnalysisResultSingletonRes All required parameters must be populated in order to send to Azure. - :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", "Fail", + and "Pass". :vartype grade: str or ~azure.mgmt.testbase.models.Grade :ivar analysis_result_type: Type of the Analysis Result. Required. Known values are: "ScriptExecution", "Reliability", "CPUUtilization", "MemoryUtilization", "CPURegression", @@ -1145,20 +1645,135 @@ def __init__( *, grade: Optional[Union[str, "_models.Grade"]] = None, cpu_utilization_results: Optional[List["_models.UtilizationResult"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", + "Fail", and "Pass". :paramtype grade: str or ~azure.mgmt.testbase.models.Grade :keyword cpu_utilization_results: The result array data. :paramtype cpu_utilization_results: list[~azure.mgmt.testbase.models.UtilizationResult] """ super().__init__(grade=grade, **kwargs) - self.analysis_result_type = "CPUUtilization" # type: str + self.analysis_result_type: str = "CPUUtilization" self.cpu_utilization_results = cpu_utilization_results +class CredentialListResult(_serialization.Model): + """A list of credential resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of credential resources. + :vartype value: list[~azure.mgmt.testbase.models.CredentialResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[CredentialResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.CredentialResource"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of credential resources. + :paramtype value: list[~azure.mgmt.testbase.models.CredentialResource] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class CredentialProperties(_serialization.Model): + """The properties of test base credential. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + IntuneSingletonResourceProperties + + All required parameters must be populated in order to send to Azure. + + :ivar credential_type: Credential type. Required. "IntuneAccount" + :vartype credential_type: str or ~azure.mgmt.testbase.models.CredentialType + :ivar display_name: Credential display name. Required. + :vartype display_name: str + """ + + _validation = { + "credential_type": {"required": True}, + "display_name": {"required": True}, + } + + _attribute_map = { + "credential_type": {"key": "credentialType", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + } + + _subtype_map = {"credential_type": {"IntuneAccount": "IntuneSingletonResourceProperties"}} + + def __init__(self, *, display_name: str, **kwargs: Any) -> None: + """ + :keyword display_name: Credential display name. Required. + :paramtype display_name: str + """ + super().__init__(**kwargs) + self.credential_type: Optional[str] = None + self.display_name = display_name + + +class CredentialResource(ProxyResource): + """The test base credential 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :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.testbase.models.SystemData + :ivar credential_type: Credential type. "IntuneAccount" + :vartype credential_type: str or ~azure.mgmt.testbase.models.CredentialType + :ivar display_name: Credential display name. + :vartype display_name: str + """ + + _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"}, + "credential_type": {"key": "properties.credentialType", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + } + + def __init__(self, *, display_name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword display_name: Credential display name. + :paramtype display_name: str + """ + super().__init__(**kwargs) + self.credential_type: Optional[str] = None + self.display_name = display_name + + class CustomerEventListResult(_serialization.Model): """A list of Test Base Customer Events. @@ -1180,7 +1795,7 @@ class CustomerEventListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.CustomerEventResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.CustomerEventResource"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Test Base Customer Events. :paramtype value: list[~azure.mgmt.testbase.models.CustomerEventResource] @@ -1195,13 +1810,16 @@ class CustomerEventResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system metadata relating to this resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.testbase.models.SystemData :ivar event_name: The name of the event subscribed to. :vartype event_name: str @@ -1230,8 +1848,8 @@ def __init__( *, event_name: Optional[str] = None, receivers: Optional[List["_models.NotificationEventReceiver"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword event_name: The name of the event subscribed to. :paramtype event_name: str @@ -1239,66 +1857,1766 @@ def __init__( :paramtype receivers: list[~azure.mgmt.testbase.models.NotificationEventReceiver] """ super().__init__(**kwargs) - self.system_data = None self.event_name = event_name self.receivers = receivers -class DistributionGroupListReceiverValue(_serialization.Model): - """The user object receiver value. +class CustomImageListResult(_serialization.Model): + """A list of Test Base custom images. - :ivar distribution_groups: The list of distribution groups. - :vartype distribution_groups: list[str] - """ + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of Test Base custom images. + :vartype value: list[~azure.mgmt.testbase.models.CustomImageResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[CustomImageResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.CustomImageResource"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of Test Base custom images. + :paramtype value: list[~azure.mgmt.testbase.models.CustomImageResource] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class CustomImageResource(ProxyResource): # pylint: disable=too-many-instance-attributes + """The test base custom image 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :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.testbase.models.SystemData + :ivar vhd_id: The Id of the associated VHD resource. + :vartype vhd_id: str + :ivar definition_name: Image definition name. + :vartype definition_name: str + :ivar version_name: Image version name. + :vartype version_name: str + :ivar source: Custom image source type. Known values are: "Unknown" and "VHD". + :vartype source: str or ~azure.mgmt.testbase.models.ImageSource + :ivar product: Product of the custom image. + :vartype product: str + :ivar release: Release of the custom image OS. + :vartype release: str + :ivar status: Status of the custom image. Known values are: "Unknown", "Ready", "Failed", and + "Validating". + :vartype status: str or ~azure.mgmt.testbase.models.ImageStatus + :ivar creation_time: The UTC timestamp when the custom image was published. + :vartype creation_time: ~datetime.datetime + :ivar validation_results: The validation result of the custom image. + :vartype validation_results: ~azure.mgmt.testbase.models.ImageValidationResults + :ivar os_disk_image_size_in_gb: This property indicates the size of the VHD to be created. + :vartype os_disk_image_size_in_gb: int + :ivar release_version_date: The release version date of the release of the custom image OS. + :vartype release_version_date: ~datetime.datetime + :ivar vhd_file_name: The file name of the associated VHD resource. + :vartype vhd_file_name: str + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.testbase.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "product": {"readonly": True}, + "release": {"readonly": True}, + "status": {"readonly": True}, + "creation_time": {"readonly": True}, + "validation_results": {"readonly": True}, + "os_disk_image_size_in_gb": {"readonly": True}, + "release_version_date": {"readonly": True}, + "vhd_file_name": {"readonly": True}, + "provisioning_state": {"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"}, + "vhd_id": {"key": "properties.vhdId", "type": "str"}, + "definition_name": {"key": "properties.definitionName", "type": "str"}, + "version_name": {"key": "properties.versionName", "type": "str"}, + "source": {"key": "properties.source", "type": "str"}, + "product": {"key": "properties.product", "type": "str"}, + "release": {"key": "properties.release", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, + "validation_results": {"key": "properties.validationResults", "type": "ImageValidationResults"}, + "os_disk_image_size_in_gb": {"key": "properties.osDiskImageSizeInGB", "type": "int"}, + "release_version_date": {"key": "properties.releaseVersionDate", "type": "iso-8601"}, + "vhd_file_name": {"key": "properties.vhdFileName", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + vhd_id: Optional[str] = None, + definition_name: Optional[str] = None, + version_name: Optional[str] = None, + source: Union[str, "_models.ImageSource"] = "VHD", + **kwargs: Any + ) -> None: + """ + :keyword vhd_id: The Id of the associated VHD resource. + :paramtype vhd_id: str + :keyword definition_name: Image definition name. + :paramtype definition_name: str + :keyword version_name: Image version name. + :paramtype version_name: str + :keyword source: Custom image source type. Known values are: "Unknown" and "VHD". + :paramtype source: str or ~azure.mgmt.testbase.models.ImageSource + """ + super().__init__(**kwargs) + self.vhd_id = vhd_id + self.definition_name = definition_name + self.version_name = version_name + self.source = source + self.product = None + self.release = None + self.status = None + self.creation_time = None + self.validation_results = None + self.os_disk_image_size_in_gb = None + self.release_version_date = None + self.vhd_file_name = None + self.provisioning_state = None + + +class DistributionGroupListReceiverValue(_serialization.Model): + """The user object receiver value. + + :ivar distribution_groups: The list of distribution groups. + :vartype distribution_groups: list[str] + """ _attribute_map = { "distribution_groups": {"key": "distributionGroups", "type": "[str]"}, } - def __init__(self, *, distribution_groups: Optional[List[str]] = None, **kwargs): + def __init__(self, *, distribution_groups: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword distribution_groups: The list of distribution groups. + :paramtype distribution_groups: list[str] + """ + super().__init__(**kwargs) + self.distribution_groups = distribution_groups + + +class DownloadURLResponse(_serialization.Model): + """The response of getting a download URL. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar download_url: The download URL. + :vartype download_url: str + :ivar expiration_time: Expiry date of the download URL. + :vartype expiration_time: ~datetime.datetime + """ + + _validation = { + "download_url": {"readonly": True}, + "expiration_time": {"readonly": True}, + } + + _attribute_map = { + "download_url": {"key": "downloadUrl", "type": "str"}, + "expiration_time": {"key": "expirationTime", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.download_url = None + self.expiration_time = None + + +class DraftPackageGetPathResponse(_serialization.Model): + """The response of getting a download URL. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar base_url: The base URL of the storage account. + :vartype base_url: str + :ivar draft_package_path: The relative path of the folder hosting package files. + :vartype draft_package_path: str + :ivar working_path: The relative path for a temporary folder for package creation work. + :vartype working_path: str + :ivar sas_token: A SAS token for the storage account to access workspace. + :vartype sas_token: str + :ivar expiration_time: Expiry date of the SAS token. + :vartype expiration_time: ~datetime.datetime + """ + + _validation = { + "base_url": {"readonly": True}, + "draft_package_path": {"readonly": True}, + "working_path": {"readonly": True}, + "sas_token": {"readonly": True}, + "expiration_time": {"readonly": True}, + } + + _attribute_map = { + "base_url": {"key": "baseUrl", "type": "str"}, + "draft_package_path": {"key": "draftPackagePath", "type": "str"}, + "working_path": {"key": "workingPath", "type": "str"}, + "sas_token": {"key": "sasToken", "type": "str"}, + "expiration_time": {"key": "expirationTime", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.base_url = None + self.draft_package_path = None + self.working_path = None + self.sas_token = None + self.expiration_time = None + + +class DraftPackageIntuneAppMetadata(_serialization.Model): + """The metadata of Intune app(s) used for generation. + + :ivar intune_app: The Metadata of the Intune App through intunewin file uploading. + :vartype intune_app: ~azure.mgmt.testbase.models.DraftPackageIntuneAppMetadataItem + :ivar intune_app_dependencies: The Metadata of dependencies of the Intune App through intunewin + file uploading. + :vartype intune_app_dependencies: + list[~azure.mgmt.testbase.models.DraftPackageIntuneAppMetadataItem] + """ + + _attribute_map = { + "intune_app": {"key": "intuneApp", "type": "DraftPackageIntuneAppMetadataItem"}, + "intune_app_dependencies": {"key": "intuneAppDependencies", "type": "[DraftPackageIntuneAppMetadataItem]"}, + } + + def __init__( + self, + *, + intune_app: Optional["_models.DraftPackageIntuneAppMetadataItem"] = None, + intune_app_dependencies: Optional[List["_models.DraftPackageIntuneAppMetadataItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword intune_app: The Metadata of the Intune App through intunewin file uploading. + :paramtype intune_app: ~azure.mgmt.testbase.models.DraftPackageIntuneAppMetadataItem + :keyword intune_app_dependencies: The Metadata of dependencies of the Intune App through + intunewin file uploading. + :paramtype intune_app_dependencies: + list[~azure.mgmt.testbase.models.DraftPackageIntuneAppMetadataItem] + """ + super().__init__(**kwargs) + self.intune_app = intune_app + self.intune_app_dependencies = intune_app_dependencies + + +class DraftPackageIntuneAppMetadataItem(_serialization.Model): # pylint: disable=too-many-instance-attributes + """The Metadata of a single Intune App. + + :ivar app_name: Intune app name. + :vartype app_name: str + :ivar version: Intune app version. + :vartype version: str + :ivar app_id: Intune app id. + :vartype app_id: str + :ivar publisher: Publisher of the app. + :vartype publisher: str + :ivar description: Description of the app. + :vartype description: str + :ivar owner: Owner of the app. + :vartype owner: str + :ivar create_date: Creation date of the app. + :vartype create_date: ~datetime.datetime + :ivar dependent_app_count: Count of dependency apps. + :vartype dependent_app_count: int + :ivar install_command: Install command. + :vartype install_command: str + :ivar uninstall_command: Uninstall command. + :vartype uninstall_command: str + :ivar last_processed: last processed time tickets. + :vartype last_processed: int + :ivar dependency_ids: Ids of dependency apps. + :vartype dependency_ids: list[str] + :ivar setup_file: Setup file path. + :vartype setup_file: str + :ivar minimum_supported_os: Minimum supported OS. The OS version must be greater than this + version to run this app. + :vartype minimum_supported_os: str + :ivar status: Extract status. Known values are: "Ready", "Uploading", "UploadFailed", + "ExtractFailed", and "NoDependencyApp". + :vartype status: str or ~azure.mgmt.testbase.models.IntuneExtractStatus + :ivar expected_exit_codes: Expected exit codes returned from Intune App. + :vartype expected_exit_codes: list[str] + """ + + _attribute_map = { + "app_name": {"key": "appName", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "app_id": {"key": "appId", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "owner": {"key": "owner", "type": "str"}, + "create_date": {"key": "createDate", "type": "iso-8601"}, + "dependent_app_count": {"key": "dependentAppCount", "type": "int"}, + "install_command": {"key": "installCommand", "type": "str"}, + "uninstall_command": {"key": "uninstallCommand", "type": "str"}, + "last_processed": {"key": "lastProcessed", "type": "int"}, + "dependency_ids": {"key": "dependencyIds", "type": "[str]"}, + "setup_file": {"key": "setupFile", "type": "str"}, + "minimum_supported_os": {"key": "minimumSupportedOS", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "expected_exit_codes": {"key": "expectedExitCodes", "type": "[str]"}, + } + + def __init__( + self, + *, + app_name: Optional[str] = None, + version: Optional[str] = None, + app_id: Optional[str] = None, + publisher: Optional[str] = None, + description: Optional[str] = None, + owner: Optional[str] = None, + create_date: Optional[datetime.datetime] = None, + dependent_app_count: Optional[int] = None, + install_command: Optional[str] = None, + uninstall_command: Optional[str] = None, + last_processed: Optional[int] = None, + dependency_ids: Optional[List[str]] = None, + setup_file: Optional[str] = None, + minimum_supported_os: Optional[str] = None, + status: Optional[Union[str, "_models.IntuneExtractStatus"]] = None, + expected_exit_codes: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword app_name: Intune app name. + :paramtype app_name: str + :keyword version: Intune app version. + :paramtype version: str + :keyword app_id: Intune app id. + :paramtype app_id: str + :keyword publisher: Publisher of the app. + :paramtype publisher: str + :keyword description: Description of the app. + :paramtype description: str + :keyword owner: Owner of the app. + :paramtype owner: str + :keyword create_date: Creation date of the app. + :paramtype create_date: ~datetime.datetime + :keyword dependent_app_count: Count of dependency apps. + :paramtype dependent_app_count: int + :keyword install_command: Install command. + :paramtype install_command: str + :keyword uninstall_command: Uninstall command. + :paramtype uninstall_command: str + :keyword last_processed: last processed time tickets. + :paramtype last_processed: int + :keyword dependency_ids: Ids of dependency apps. + :paramtype dependency_ids: list[str] + :keyword setup_file: Setup file path. + :paramtype setup_file: str + :keyword minimum_supported_os: Minimum supported OS. The OS version must be greater than this + version to run this app. + :paramtype minimum_supported_os: str + :keyword status: Extract status. Known values are: "Ready", "Uploading", "UploadFailed", + "ExtractFailed", and "NoDependencyApp". + :paramtype status: str or ~azure.mgmt.testbase.models.IntuneExtractStatus + :keyword expected_exit_codes: Expected exit codes returned from Intune App. + :paramtype expected_exit_codes: list[str] + """ + super().__init__(**kwargs) + self.app_name = app_name + self.version = version + self.app_id = app_id + self.publisher = publisher + self.description = description + self.owner = owner + self.create_date = create_date + self.dependent_app_count = dependent_app_count + self.install_command = install_command + self.uninstall_command = uninstall_command + self.last_processed = last_processed + self.dependency_ids = dependency_ids + self.setup_file = setup_file + self.minimum_supported_os = minimum_supported_os + self.status = status + self.expected_exit_codes = expected_exit_codes + + +class DraftPackageListResult(_serialization.Model): + """A list of Test Base Draft Packages. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of Test Base Draft Packages. + :vartype value: list[~azure.mgmt.testbase.models.DraftPackageResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DraftPackageResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.DraftPackageResource"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of Test Base Draft Packages. + :paramtype value: list[~azure.mgmt.testbase.models.DraftPackageResource] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DraftPackageResource(ProxyResource): # pylint: disable=too-many-instance-attributes + """The Test Base Draft Package 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :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.testbase.models.SystemData + :ivar application_name: Application name. + :vartype application_name: str + :ivar version: Application version. + :vartype version: str + :ivar draft_package_path: The relative path of the folder hosting package files. + :vartype draft_package_path: str + :ivar working_path: The relative path for a temporarily folder for package creation work. + :vartype working_path: str + :ivar app_file_name: The name of the app file. + :vartype app_file_name: str + :ivar source_type: The source type. Known values are: "Native", "IntuneWin", "TestBasePackage", + "GalleryApp", and "IntuneEnrollment". + :vartype source_type: str or ~azure.mgmt.testbase.models.DraftPackageSourceType + :ivar use_sample: Specifies whether a sample package should be used instead of the one uploaded + by the user. + :vartype use_sample: bool + :ivar comments: Comments added by user. + :vartype comments: str + :ivar intune_metadata: Metadata used to generate draft package folder and scripts. + :vartype intune_metadata: ~azure.mgmt.testbase.models.DraftPackageIntuneAppMetadata + :ivar highlighted_files: The highlight files in the package. + :vartype highlighted_files: list[~azure.mgmt.testbase.models.HighlightedFile] + :ivar package_tags: Tags of the package to be created. + :vartype package_tags: dict[str, str] + :ivar edit_package: Specifies whether this draft package is used to edit a package. + :vartype edit_package: bool + :ivar package_id: Specifies the package id from which the draft package copied. + :vartype package_id: str + :ivar use_autofill: Indicates whether user choose to enable script auto-fill. + :vartype use_autofill: bool + :ivar executable_launch_command: The executable launch command for script auto-fill. Will be + used to run the application. + :vartype executable_launch_command: str + :ivar process_name: The process name for script auto-fill. Will be used to identify the + application process. + :vartype process_name: str + :ivar tab_state: Tab state. + :vartype tab_state: ~azure.mgmt.testbase.models.TabState + :ivar test_types: OOB, functional or flow driven. Mapped to the data in 'tests' property. + :vartype test_types: list[str or ~azure.mgmt.testbase.models.TestType] + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.testbase.models.ProvisioningState + :ivar target_os_list: Specifies the target OSs of specific OS Update types. + :vartype target_os_list: list[~azure.mgmt.testbase.models.TargetOSInfo] + :ivar inplace_upgrade_os_pair: Specifies the baseline os and target os for inplace upgrade. + :vartype inplace_upgrade_os_pair: ~azure.mgmt.testbase.models.InplaceUpgradeOSInfo + :ivar last_modified_time: The UTC timestamp when the package was last modified. + :vartype last_modified_time: ~datetime.datetime + :ivar flighting_ring: The flighting ring for feature update. + :vartype flighting_ring: str + :ivar first_party_apps: The list of first party applications to test along with user + application. + :vartype first_party_apps: list[~azure.mgmt.testbase.models.FirstPartyAppDefinition] + :ivar gallery_apps: The list of gallery apps to test along with user application. + :vartype gallery_apps: list[~azure.mgmt.testbase.models.GalleryAppDefinition] + :ivar tests: The detailed test information. + :vartype tests: list[~azure.mgmt.testbase.models.Test] + :ivar intune_enrollment_metadata: The metadata of Intune enrollment. + :vartype intune_enrollment_metadata: ~azure.mgmt.testbase.models.IntuneEnrollmentMetadata + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "draft_package_path": {"readonly": True}, + "working_path": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "last_modified_time": {"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"}, + "application_name": {"key": "properties.applicationName", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "draft_package_path": {"key": "properties.draftPackagePath", "type": "str"}, + "working_path": {"key": "properties.workingPath", "type": "str"}, + "app_file_name": {"key": "properties.appFileName", "type": "str"}, + "source_type": {"key": "properties.sourceType", "type": "str"}, + "use_sample": {"key": "properties.useSample", "type": "bool"}, + "comments": {"key": "properties.comments", "type": "str"}, + "intune_metadata": {"key": "properties.intuneMetadata", "type": "DraftPackageIntuneAppMetadata"}, + "highlighted_files": {"key": "properties.highlightedFiles", "type": "[HighlightedFile]"}, + "package_tags": {"key": "properties.packageTags", "type": "{str}"}, + "edit_package": {"key": "properties.editPackage", "type": "bool"}, + "package_id": {"key": "properties.packageId", "type": "str"}, + "use_autofill": {"key": "properties.useAutofill", "type": "bool"}, + "executable_launch_command": {"key": "properties.executableLaunchCommand", "type": "str"}, + "process_name": {"key": "properties.processName", "type": "str"}, + "tab_state": {"key": "properties.tabState", "type": "TabState"}, + "test_types": {"key": "properties.testTypes", "type": "[str]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "target_os_list": {"key": "properties.targetOSList", "type": "[TargetOSInfo]"}, + "inplace_upgrade_os_pair": {"key": "properties.inplaceUpgradeOSPair", "type": "InplaceUpgradeOSInfo"}, + "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, + "flighting_ring": {"key": "properties.flightingRing", "type": "str"}, + "first_party_apps": {"key": "properties.firstPartyApps", "type": "[FirstPartyAppDefinition]"}, + "gallery_apps": {"key": "properties.galleryApps", "type": "[GalleryAppDefinition]"}, + "tests": {"key": "properties.tests", "type": "[Test]"}, + "intune_enrollment_metadata": { + "key": "properties.intuneEnrollmentMetadata", + "type": "IntuneEnrollmentMetadata", + }, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + application_name: Optional[str] = None, + version: Optional[str] = None, + app_file_name: Optional[str] = None, + source_type: Optional[Union[str, "_models.DraftPackageSourceType"]] = None, + use_sample: Optional[bool] = None, + comments: Optional[str] = None, + intune_metadata: Optional["_models.DraftPackageIntuneAppMetadata"] = None, + highlighted_files: Optional[List["_models.HighlightedFile"]] = None, + package_tags: Optional[Dict[str, str]] = None, + edit_package: bool = False, + package_id: Optional[str] = None, + use_autofill: Optional[bool] = None, + executable_launch_command: Optional[str] = None, + process_name: Optional[str] = None, + tab_state: Optional["_models.TabState"] = None, + test_types: Optional[List[Union[str, "_models.TestType"]]] = None, + target_os_list: Optional[List["_models.TargetOSInfo"]] = None, + inplace_upgrade_os_pair: Optional["_models.InplaceUpgradeOSInfo"] = None, + flighting_ring: Optional[str] = None, + first_party_apps: Optional[List["_models.FirstPartyAppDefinition"]] = None, + gallery_apps: Optional[List["_models.GalleryAppDefinition"]] = None, + tests: Optional[List["_models.Test"]] = None, + intune_enrollment_metadata: Optional["_models.IntuneEnrollmentMetadata"] = None, + **kwargs: Any + ) -> None: + """ + :keyword application_name: Application name. + :paramtype application_name: str + :keyword version: Application version. + :paramtype version: str + :keyword app_file_name: The name of the app file. + :paramtype app_file_name: str + :keyword source_type: The source type. Known values are: "Native", "IntuneWin", + "TestBasePackage", "GalleryApp", and "IntuneEnrollment". + :paramtype source_type: str or ~azure.mgmt.testbase.models.DraftPackageSourceType + :keyword use_sample: Specifies whether a sample package should be used instead of the one + uploaded by the user. + :paramtype use_sample: bool + :keyword comments: Comments added by user. + :paramtype comments: str + :keyword intune_metadata: Metadata used to generate draft package folder and scripts. + :paramtype intune_metadata: ~azure.mgmt.testbase.models.DraftPackageIntuneAppMetadata + :keyword highlighted_files: The highlight files in the package. + :paramtype highlighted_files: list[~azure.mgmt.testbase.models.HighlightedFile] + :keyword package_tags: Tags of the package to be created. + :paramtype package_tags: dict[str, str] + :keyword edit_package: Specifies whether this draft package is used to edit a package. + :paramtype edit_package: bool + :keyword package_id: Specifies the package id from which the draft package copied. + :paramtype package_id: str + :keyword use_autofill: Indicates whether user choose to enable script auto-fill. + :paramtype use_autofill: bool + :keyword executable_launch_command: The executable launch command for script auto-fill. Will be + used to run the application. + :paramtype executable_launch_command: str + :keyword process_name: The process name for script auto-fill. Will be used to identify the + application process. + :paramtype process_name: str + :keyword tab_state: Tab state. + :paramtype tab_state: ~azure.mgmt.testbase.models.TabState + :keyword test_types: OOB, functional or flow driven. Mapped to the data in 'tests' property. + :paramtype test_types: list[str or ~azure.mgmt.testbase.models.TestType] + :keyword target_os_list: Specifies the target OSs of specific OS Update types. + :paramtype target_os_list: list[~azure.mgmt.testbase.models.TargetOSInfo] + :keyword inplace_upgrade_os_pair: Specifies the baseline os and target os for inplace upgrade. + :paramtype inplace_upgrade_os_pair: ~azure.mgmt.testbase.models.InplaceUpgradeOSInfo + :keyword flighting_ring: The flighting ring for feature update. + :paramtype flighting_ring: str + :keyword first_party_apps: The list of first party applications to test along with user + application. + :paramtype first_party_apps: list[~azure.mgmt.testbase.models.FirstPartyAppDefinition] + :keyword gallery_apps: The list of gallery apps to test along with user application. + :paramtype gallery_apps: list[~azure.mgmt.testbase.models.GalleryAppDefinition] + :keyword tests: The detailed test information. + :paramtype tests: list[~azure.mgmt.testbase.models.Test] + :keyword intune_enrollment_metadata: The metadata of Intune enrollment. + :paramtype intune_enrollment_metadata: ~azure.mgmt.testbase.models.IntuneEnrollmentMetadata + """ + super().__init__(**kwargs) + self.application_name = application_name + self.version = version + self.draft_package_path = None + self.working_path = None + self.app_file_name = app_file_name + self.source_type = source_type + self.use_sample = use_sample + self.comments = comments + self.intune_metadata = intune_metadata + self.highlighted_files = highlighted_files + self.package_tags = package_tags + self.edit_package = edit_package + self.package_id = package_id + self.use_autofill = use_autofill + self.executable_launch_command = executable_launch_command + self.process_name = process_name + self.tab_state = tab_state + self.test_types = test_types + self.provisioning_state = None + self.target_os_list = target_os_list + self.inplace_upgrade_os_pair = inplace_upgrade_os_pair + self.last_modified_time = None + self.flighting_ring = flighting_ring + self.first_party_apps = first_party_apps + self.gallery_apps = gallery_apps + self.tests = tests + self.intune_enrollment_metadata = intune_enrollment_metadata + + +class DraftPackageUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Parameters supplied to update a Test Base Draft Package. + + :ivar application_name: Application name. + :vartype application_name: str + :ivar version: Application version. + :vartype version: str + :ivar app_file_name: The name of the app file. + :vartype app_file_name: str + :ivar source_type: The source type. Known values are: "Native", "IntuneWin", "TestBasePackage", + "GalleryApp", and "IntuneEnrollment". + :vartype source_type: str or ~azure.mgmt.testbase.models.DraftPackageSourceType + :ivar use_sample: Specifies whether a sample package should be used instead of the one uploaded + by the user. + :vartype use_sample: bool + :ivar comments: Comments added by user. + :vartype comments: str + :ivar intune_metadata: Metadata used to generate draft package folder and scripts. + :vartype intune_metadata: ~azure.mgmt.testbase.models.DraftPackageIntuneAppMetadata + :ivar highlighted_files: The highlight files in the package. + :vartype highlighted_files: list[~azure.mgmt.testbase.models.HighlightedFile] + :ivar package_tags: Tags of the package to be created. + :vartype package_tags: dict[str, str] + :ivar package_id: Specifies the package id from which the draft package copied. + :vartype package_id: str + :ivar use_autofill: Indicates whether user choose to enable script auto-fill. + :vartype use_autofill: bool + :ivar executable_launch_command: The executable launch command for script auto-fill. Will be + used to run the application. + :vartype executable_launch_command: str + :ivar process_name: The process name for script auto-fill. Will be used to identify the + application process. + :vartype process_name: str + :ivar tab_state: Tab state. + :vartype tab_state: ~azure.mgmt.testbase.models.TabState + :ivar test_types: OOB, functional or flow driven. Mapped to the data in 'tests' property. + :vartype test_types: list[str or ~azure.mgmt.testbase.models.TestType] + :ivar target_os_list: Specifies the target OSs of specific OS Update types. + :vartype target_os_list: list[~azure.mgmt.testbase.models.TargetOSInfo] + :ivar inplace_upgrade_os_pair: Specifies the baseline os and target os for in-place upgrade. + :vartype inplace_upgrade_os_pair: ~azure.mgmt.testbase.models.InplaceUpgradeOSInfo + :ivar flighting_ring: The flighting ring for feature update. + :vartype flighting_ring: str + :ivar first_party_apps: Specifies the list of first party applications to test along with user + application. + :vartype first_party_apps: list[~azure.mgmt.testbase.models.FirstPartyAppDefinition] + :ivar gallery_apps: The list of gallery apps to test along with user application. + :vartype gallery_apps: list[~azure.mgmt.testbase.models.GalleryAppDefinition] + :ivar tests: The detailed test information. + :vartype tests: list[~azure.mgmt.testbase.models.Test] + :ivar intune_enrollment_metadata: The metadata of Intune enrollment. + :vartype intune_enrollment_metadata: ~azure.mgmt.testbase.models.IntuneEnrollmentMetadata + """ + + _attribute_map = { + "application_name": {"key": "properties.applicationName", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "app_file_name": {"key": "properties.appFileName", "type": "str"}, + "source_type": {"key": "properties.sourceType", "type": "str"}, + "use_sample": {"key": "properties.useSample", "type": "bool"}, + "comments": {"key": "properties.comments", "type": "str"}, + "intune_metadata": {"key": "properties.intuneMetadata", "type": "DraftPackageIntuneAppMetadata"}, + "highlighted_files": {"key": "properties.highlightedFiles", "type": "[HighlightedFile]"}, + "package_tags": {"key": "properties.packageTags", "type": "{str}"}, + "package_id": {"key": "properties.packageId", "type": "str"}, + "use_autofill": {"key": "properties.useAutofill", "type": "bool"}, + "executable_launch_command": {"key": "properties.executableLaunchCommand", "type": "str"}, + "process_name": {"key": "properties.processName", "type": "str"}, + "tab_state": {"key": "properties.tabState", "type": "TabState"}, + "test_types": {"key": "properties.testTypes", "type": "[str]"}, + "target_os_list": {"key": "properties.targetOSList", "type": "[TargetOSInfo]"}, + "inplace_upgrade_os_pair": {"key": "properties.inplaceUpgradeOSPair", "type": "InplaceUpgradeOSInfo"}, + "flighting_ring": {"key": "properties.flightingRing", "type": "str"}, + "first_party_apps": {"key": "properties.firstPartyApps", "type": "[FirstPartyAppDefinition]"}, + "gallery_apps": {"key": "properties.galleryApps", "type": "[GalleryAppDefinition]"}, + "tests": {"key": "properties.tests", "type": "[Test]"}, + "intune_enrollment_metadata": { + "key": "properties.intuneEnrollmentMetadata", + "type": "IntuneEnrollmentMetadata", + }, + } + + def __init__( + self, + *, + application_name: Optional[str] = None, + version: Optional[str] = None, + app_file_name: Optional[str] = None, + source_type: Optional[Union[str, "_models.DraftPackageSourceType"]] = None, + use_sample: Optional[bool] = None, + comments: Optional[str] = None, + intune_metadata: Optional["_models.DraftPackageIntuneAppMetadata"] = None, + highlighted_files: Optional[List["_models.HighlightedFile"]] = None, + package_tags: Optional[Dict[str, str]] = None, + package_id: Optional[str] = None, + use_autofill: Optional[bool] = None, + executable_launch_command: Optional[str] = None, + process_name: Optional[str] = None, + tab_state: Optional["_models.TabState"] = None, + test_types: Optional[List[Union[str, "_models.TestType"]]] = None, + target_os_list: Optional[List["_models.TargetOSInfo"]] = None, + inplace_upgrade_os_pair: Optional["_models.InplaceUpgradeOSInfo"] = None, + flighting_ring: Optional[str] = None, + first_party_apps: Optional[List["_models.FirstPartyAppDefinition"]] = None, + gallery_apps: Optional[List["_models.GalleryAppDefinition"]] = None, + tests: Optional[List["_models.Test"]] = None, + intune_enrollment_metadata: Optional["_models.IntuneEnrollmentMetadata"] = None, + **kwargs: Any + ) -> None: + """ + :keyword application_name: Application name. + :paramtype application_name: str + :keyword version: Application version. + :paramtype version: str + :keyword app_file_name: The name of the app file. + :paramtype app_file_name: str + :keyword source_type: The source type. Known values are: "Native", "IntuneWin", + "TestBasePackage", "GalleryApp", and "IntuneEnrollment". + :paramtype source_type: str or ~azure.mgmt.testbase.models.DraftPackageSourceType + :keyword use_sample: Specifies whether a sample package should be used instead of the one + uploaded by the user. + :paramtype use_sample: bool + :keyword comments: Comments added by user. + :paramtype comments: str + :keyword intune_metadata: Metadata used to generate draft package folder and scripts. + :paramtype intune_metadata: ~azure.mgmt.testbase.models.DraftPackageIntuneAppMetadata + :keyword highlighted_files: The highlight files in the package. + :paramtype highlighted_files: list[~azure.mgmt.testbase.models.HighlightedFile] + :keyword package_tags: Tags of the package to be created. + :paramtype package_tags: dict[str, str] + :keyword package_id: Specifies the package id from which the draft package copied. + :paramtype package_id: str + :keyword use_autofill: Indicates whether user choose to enable script auto-fill. + :paramtype use_autofill: bool + :keyword executable_launch_command: The executable launch command for script auto-fill. Will be + used to run the application. + :paramtype executable_launch_command: str + :keyword process_name: The process name for script auto-fill. Will be used to identify the + application process. + :paramtype process_name: str + :keyword tab_state: Tab state. + :paramtype tab_state: ~azure.mgmt.testbase.models.TabState + :keyword test_types: OOB, functional or flow driven. Mapped to the data in 'tests' property. + :paramtype test_types: list[str or ~azure.mgmt.testbase.models.TestType] + :keyword target_os_list: Specifies the target OSs of specific OS Update types. + :paramtype target_os_list: list[~azure.mgmt.testbase.models.TargetOSInfo] + :keyword inplace_upgrade_os_pair: Specifies the baseline os and target os for in-place upgrade. + :paramtype inplace_upgrade_os_pair: ~azure.mgmt.testbase.models.InplaceUpgradeOSInfo + :keyword flighting_ring: The flighting ring for feature update. + :paramtype flighting_ring: str + :keyword first_party_apps: Specifies the list of first party applications to test along with + user application. + :paramtype first_party_apps: list[~azure.mgmt.testbase.models.FirstPartyAppDefinition] + :keyword gallery_apps: The list of gallery apps to test along with user application. + :paramtype gallery_apps: list[~azure.mgmt.testbase.models.GalleryAppDefinition] + :keyword tests: The detailed test information. + :paramtype tests: list[~azure.mgmt.testbase.models.Test] + :keyword intune_enrollment_metadata: The metadata of Intune enrollment. + :paramtype intune_enrollment_metadata: ~azure.mgmt.testbase.models.IntuneEnrollmentMetadata + """ + super().__init__(**kwargs) + self.application_name = application_name + self.version = version + self.app_file_name = app_file_name + self.source_type = source_type + self.use_sample = use_sample + self.comments = comments + self.intune_metadata = intune_metadata + self.highlighted_files = highlighted_files + self.package_tags = package_tags + self.package_id = package_id + self.use_autofill = use_autofill + self.executable_launch_command = executable_launch_command + self.process_name = process_name + self.tab_state = tab_state + self.test_types = test_types + self.target_os_list = target_os_list + self.inplace_upgrade_os_pair = inplace_upgrade_os_pair + self.flighting_ring = flighting_ring + self.first_party_apps = first_party_apps + self.gallery_apps = gallery_apps + self.tests = tests + self.intune_enrollment_metadata = intune_enrollment_metadata + + +class EmailEventListResult(_serialization.Model): + """A list of email events. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of email events. + :vartype value: list[~azure.mgmt.testbase.models.EmailEventResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[EmailEventResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.EmailEventResource"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of email events. + :paramtype value: list[~azure.mgmt.testbase.models.EmailEventResource] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class EmailEventResource(ProxyResource): + """The email event 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :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.testbase.models.SystemData + :ivar event_id: The identifier of the email event. + :vartype event_id: str + :ivar event_name: The name of the email event. + :vartype event_name: str + :ivar display_name: The display name of the email event. + :vartype display_name: str + """ + + _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"}, + "event_id": {"key": "properties.eventId", "type": "str"}, + "event_name": {"key": "properties.eventName", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + } + + def __init__( + self, + *, + event_id: Optional[str] = None, + event_name: Optional[str] = None, + display_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword event_id: The identifier of the email event. + :paramtype event_id: str + :keyword event_name: The name of the email event. + :paramtype event_name: str + :keyword display_name: The display name of the email event. + :paramtype display_name: str + """ + super().__init__(**kwargs) + self.event_id = event_id + self.event_name = event_name + self.display_name = display_name + + +class EnrolledIntuneApp(_serialization.Model): + """Metadata of the enrolled Intune app. + + All required parameters must be populated in order to send to Azure. + + :ivar app_name: Intune app name. Required. + :vartype app_name: str + :ivar app_id: Intune app id. Required. + :vartype app_id: str + :ivar expected_installation_path: Intune app expected installation path. Required. + :vartype expected_installation_path: str + """ + + _validation = { + "app_name": {"required": True}, + "app_id": {"required": True}, + "expected_installation_path": {"required": True}, + } + + _attribute_map = { + "app_name": {"key": "appName", "type": "str"}, + "app_id": {"key": "appId", "type": "str"}, + "expected_installation_path": {"key": "expectedInstallationPath", "type": "str"}, + } + + def __init__(self, *, app_name: str, app_id: str, expected_installation_path: str, **kwargs: Any) -> None: + """ + :keyword app_name: Intune app name. Required. + :paramtype app_name: str + :keyword app_id: Intune app id. Required. + :paramtype app_id: str + :keyword expected_installation_path: Intune app expected installation path. Required. + :paramtype expected_installation_path: str + """ + super().__init__(**kwargs) + self.app_name = app_name + self.app_id = app_id + self.expected_installation_path = expected_installation_path + + +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.testbase.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.testbase.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.testbase.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.testbase.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class ExtractFileOperationParameters(_serialization.Model): + """Parameters body to pass to extract file operation of Draft Package. + + All required parameters must be populated in order to send to Azure. + + :ivar file_type: The type of file to extract. Known values are: "TestBasePackage" and + "IntuneWinPackage". + :vartype file_type: str or ~azure.mgmt.testbase.models.ExtractFileType + :ivar source_file: Relative path of the file to be extracted, the path must under working path + of this draft package. Required. + :vartype source_file: str + :ivar intune_app_id: Intune application id. + :vartype intune_app_id: str + """ + + _validation = { + "source_file": {"required": True}, + } + + _attribute_map = { + "file_type": {"key": "fileType", "type": "str"}, + "source_file": {"key": "sourceFile", "type": "str"}, + "intune_app_id": {"key": "intuneAppId", "type": "str"}, + } + + def __init__( + self, + *, + source_file: str, + file_type: Optional[Union[str, "_models.ExtractFileType"]] = None, + intune_app_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword file_type: The type of file to extract. Known values are: "TestBasePackage" and + "IntuneWinPackage". + :paramtype file_type: str or ~azure.mgmt.testbase.models.ExtractFileType + :keyword source_file: Relative path of the file to be extracted, the path must under working + path of this draft package. Required. + :paramtype source_file: str + :keyword intune_app_id: Intune application id. + :paramtype intune_app_id: str + """ + super().__init__(**kwargs) + self.file_type = file_type + self.source_file = source_file + self.intune_app_id = intune_app_id + + +class FavoriteProcessListResult(_serialization.Model): + """A list of favorite processes for a package. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of favorite processes for a package. + :vartype value: list[~azure.mgmt.testbase.models.FavoriteProcessResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[FavoriteProcessResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.FavoriteProcessResource"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of favorite processes for a package. + :paramtype value: list[~azure.mgmt.testbase.models.FavoriteProcessResource] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class FavoriteProcessResource(ProxyResource): + """A favorite process identifier. + + 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}". + :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.testbase.models.SystemData + :ivar actual_process_name: The actual name of the favorite process. It will be equal to + resource name except for the scenario that the process name contains characters that are not + allowed in the resource name. + :vartype actual_process_name: str + """ + + _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"}, + "actual_process_name": {"key": "properties.actualProcessName", "type": "str"}, + } + + def __init__(self, *, actual_process_name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword actual_process_name: The actual name of the favorite process. It will be equal to + resource name except for the scenario that the process name contains characters that are not + allowed in the resource name. + :paramtype actual_process_name: str + """ + super().__init__(**kwargs) + self.actual_process_name = actual_process_name + + +class FeatureUpdateSupportedOsesResource(ProxyResource): # pylint: disable=too-many-instance-attributes + """Feature update supported OSes proxy 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :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.testbase.models.SystemData + :ivar os_id: + :vartype os_id: str + :ivar os_name: + :vartype os_name: str + :ivar insider_channel: + :vartype insider_channel: str + :ivar version: + :vartype version: str + :ivar display_text: + :vartype display_text: str + :ivar baseline_products: + :vartype baseline_products: list[str] + :ivar start_time: Timestamp when the OS starts to be supported. + :vartype start_time: ~datetime.datetime + :ivar state: State of the OS product. Known values are: "Disabled" and "Active". + :vartype state: str or ~azure.mgmt.testbase.models.OsProductState + """ + + _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"}, + "os_id": {"key": "properties.osId", "type": "str"}, + "os_name": {"key": "properties.osName", "type": "str"}, + "insider_channel": {"key": "properties.insiderChannel", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "display_text": {"key": "properties.displayText", "type": "str"}, + "baseline_products": {"key": "properties.baselineProducts", "type": "[str]"}, + "start_time": {"key": "properties.startTime", "type": "iso-8601"}, + "state": {"key": "properties.state", "type": "str"}, + } + + def __init__( + self, + *, + os_id: Optional[str] = None, + os_name: Optional[str] = None, + insider_channel: Optional[str] = None, + version: Optional[str] = None, + display_text: Optional[str] = None, + baseline_products: Optional[List[str]] = None, + start_time: Optional[datetime.datetime] = None, + state: Optional[Union[str, "_models.OsProductState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword os_id: + :paramtype os_id: str + :keyword os_name: + :paramtype os_name: str + :keyword insider_channel: + :paramtype insider_channel: str + :keyword version: + :paramtype version: str + :keyword display_text: + :paramtype display_text: str + :keyword baseline_products: + :paramtype baseline_products: list[str] + :keyword start_time: Timestamp when the OS starts to be supported. + :paramtype start_time: ~datetime.datetime + :keyword state: State of the OS product. Known values are: "Disabled" and "Active". + :paramtype state: str or ~azure.mgmt.testbase.models.OsProductState + """ + super().__init__(**kwargs) + self.os_id = os_id + self.os_name = os_name + self.insider_channel = insider_channel + self.version = version + self.display_text = display_text + self.baseline_products = baseline_products + self.start_time = start_time + self.state = state + + +class FeatureUpdateSupportedOsesResult(_serialization.Model): + """Response schema of feature update supported OSes list API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: + :vartype value: list[~azure.mgmt.testbase.models.FeatureUpdateSupportedOsesResource] + :ivar next_link: + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[FeatureUpdateSupportedOsesResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.FeatureUpdateSupportedOsesResource"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: + :paramtype value: list[~azure.mgmt.testbase.models.FeatureUpdateSupportedOsesResource] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class FileUploadURLResponse(_serialization.Model): + """The URL response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar upload_url: The URL used for uploading the package. + :vartype upload_url: str + :ivar blob_path: The blob path of the uploaded package. It will be used as the 'blobPath' + property of PackageResource. + :vartype blob_path: str + """ + + _validation = { + "upload_url": {"readonly": True}, + "blob_path": {"readonly": True}, + } + + _attribute_map = { + "upload_url": {"key": "uploadUrl", "type": "str"}, + "blob_path": {"key": "blobPath", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.upload_url = None + self.blob_path = None + + +class FirstPartyAppDefinition(_serialization.Model): + """Properties of the definition of a first party application of the Test Base package. + + :ivar name: The media name of a first party application of a Test Base Account. + :vartype name: str + :ivar architecture: The architecture of a first party application of a Test Base Account. Known + values are: "x86", "x64", and "arm64". + :vartype architecture: str or ~azure.mgmt.testbase.models.Architecture + :ivar channel: The channel info of a first party application of a Test Base Account. + :vartype channel: str + :ivar ring: The ring info of a first party application of a Test Base Account. + :vartype ring: str + :ivar interop_execution_mode: Specifies how the first party applications should be + inter-operated with user's application. Known values are: "firstPartyAppWithTests" and + "firstPartyApp". + :vartype interop_execution_mode: str or ~azure.mgmt.testbase.models.InteropExecutionMode + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "architecture": {"key": "architecture", "type": "str"}, + "channel": {"key": "channel", "type": "str"}, + "ring": {"key": "ring", "type": "str"}, + "interop_execution_mode": {"key": "interopExecutionMode", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + architecture: Optional[Union[str, "_models.Architecture"]] = None, + channel: Optional[str] = None, + ring: Optional[str] = None, + interop_execution_mode: Union[str, "_models.InteropExecutionMode"] = "firstPartyAppWithTests", + **kwargs: Any + ) -> None: + """ + :keyword name: The media name of a first party application of a Test Base Account. + :paramtype name: str + :keyword architecture: The architecture of a first party application of a Test Base Account. + Known values are: "x86", "x64", and "arm64". + :paramtype architecture: str or ~azure.mgmt.testbase.models.Architecture + :keyword channel: The channel info of a first party application of a Test Base Account. + :paramtype channel: str + :keyword ring: The ring info of a first party application of a Test Base Account. + :paramtype ring: str + :keyword interop_execution_mode: Specifies how the first party applications should be + inter-operated with user's application. Known values are: "firstPartyAppWithTests" and + "firstPartyApp". + :paramtype interop_execution_mode: str or ~azure.mgmt.testbase.models.InteropExecutionMode + """ + super().__init__(**kwargs) + self.name = name + self.architecture = architecture + self.channel = channel + self.ring = ring + self.interop_execution_mode = interop_execution_mode + + +class FirstPartyAppListResult(_serialization.Model): + """A list of currently available first party applications. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of currently available first party applications. + :vartype value: list[~azure.mgmt.testbase.models.FirstPartyAppResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[FirstPartyAppResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.FirstPartyAppResource"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of currently available first party applications. + :paramtype value: list[~azure.mgmt.testbase.models.FirstPartyAppResource] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class FirstPartyAppResource(ProxyResource): + """The first party application 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :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.testbase.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.testbase.models.ProvisioningState + :ivar media_type: The media type of a first party application of a Test Base Account. + :vartype media_type: str + :ivar architecture: The architecture of a first party application of a Test Base Account. Known + values are: "x86", "x64", and "arm64". + :vartype architecture: str or ~azure.mgmt.testbase.models.Architecture + :ivar channel: The channel info of a first party application of a Test Base Account. + :vartype channel: str + :ivar ring: The ring info of a first party application of a Test Base Account. + :vartype ring: str + :ivar supported_products: The supported OS products of a first party application of a Test Base + Account. + :vartype supported_products: list[str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"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"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "media_type": {"key": "properties.mediaType", "type": "str"}, + "architecture": {"key": "properties.architecture", "type": "str"}, + "channel": {"key": "properties.channel", "type": "str"}, + "ring": {"key": "properties.ring", "type": "str"}, + "supported_products": {"key": "properties.supportedProducts", "type": "[str]"}, + } + + def __init__( + self, + *, + media_type: Optional[str] = None, + architecture: Optional[Union[str, "_models.Architecture"]] = None, + channel: Optional[str] = None, + ring: Optional[str] = None, + supported_products: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword media_type: The media type of a first party application of a Test Base Account. + :paramtype media_type: str + :keyword architecture: The architecture of a first party application of a Test Base Account. + Known values are: "x86", "x64", and "arm64". + :paramtype architecture: str or ~azure.mgmt.testbase.models.Architecture + :keyword channel: The channel info of a first party application of a Test Base Account. + :paramtype channel: str + :keyword ring: The ring info of a first party application of a Test Base Account. + :paramtype ring: str + :keyword supported_products: The supported OS products of a first party application of a Test + Base Account. + :paramtype supported_products: list[str] + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.media_type = media_type + self.architecture = architecture + self.channel = channel + self.ring = ring + self.supported_products = supported_products + + +class FlightingRingListResult(_serialization.Model): + """A list of flighting rings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of flighting rings. + :vartype value: list[~azure.mgmt.testbase.models.FlightingRingResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[FlightingRingResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.FlightingRingResource"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of flighting rings. + :paramtype value: list[~azure.mgmt.testbase.models.FlightingRingResource] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class FlightingRingResource(ProxyResource): + """The flighting ring 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :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.testbase.models.SystemData + :ivar actual_flighting_ring_name: The actual name of a flighting ring of a Test Base Account. + :vartype actual_flighting_ring_name: str + """ + + _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"}, + "actual_flighting_ring_name": {"key": "properties.actualFlightingRingName", "type": "str"}, + } + + def __init__(self, *, actual_flighting_ring_name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword actual_flighting_ring_name: The actual name of a flighting ring of a Test Base + Account. + :paramtype actual_flighting_ring_name: str + """ + super().__init__(**kwargs) + self.actual_flighting_ring_name = actual_flighting_ring_name + + +class FreeHourBalanceResource(ProxyResource): + """The Free Hour Balance 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :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.testbase.models.SystemData + :ivar total_remaining_free_hours: + :vartype total_remaining_free_hours: float + :ivar increment_entries: + :vartype increment_entries: list[~azure.mgmt.testbase.models.BillingHubFreeHourIncrementEntry] + """ + + _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"}, + "total_remaining_free_hours": {"key": "properties.totalRemainingFreeHours", "type": "float"}, + "increment_entries": {"key": "properties.incrementEntries", "type": "[BillingHubFreeHourIncrementEntry]"}, + } + + def __init__( + self, + *, + total_remaining_free_hours: Optional[float] = None, + increment_entries: Optional[List["_models.BillingHubFreeHourIncrementEntry"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword total_remaining_free_hours: + :paramtype total_remaining_free_hours: float + :keyword increment_entries: + :paramtype increment_entries: + list[~azure.mgmt.testbase.models.BillingHubFreeHourIncrementEntry] + """ + super().__init__(**kwargs) + self.total_remaining_free_hours = total_remaining_free_hours + self.increment_entries = increment_entries + + +class FreeHourBalancesListResult(_serialization.Model): + """A list of Test Base Free Hour Balances. It will only contain one element as all the data will + be nested in a singleton object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of FreeHourBalances. + :vartype value: list[~azure.mgmt.testbase.models.FreeHourBalanceResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[FreeHourBalanceResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.FreeHourBalanceResource"]] = None, **kwargs: Any) -> None: """ - :keyword distribution_groups: The list of distribution groups. - :paramtype distribution_groups: list[str] + :keyword value: The list of FreeHourBalances. + :paramtype value: list[~azure.mgmt.testbase.models.FreeHourBalanceResource] """ super().__init__(**kwargs) - self.distribution_groups = distribution_groups + self.value = value + self.next_link = None -class DownloadURLResponse(_serialization.Model): - """The response of getting a download URL. +class GalleryAppDefinition(_serialization.Model): + """Properties of the definition of a gallery application used in Test Base package. - 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. - :ivar download_url: The download URL. - :vartype download_url: str - :ivar expiration_time: Expiry date of the download URL. - :vartype expiration_time: ~datetime.datetime + :ivar sku_id: The SKU id of the gallery application. Required. + :vartype sku_id: str + :ivar is_consented: Whether the disclaimer of the gallery application is accepted. + :vartype is_consented: bool """ _validation = { - "download_url": {"readonly": True}, - "expiration_time": {"readonly": True}, + "sku_id": {"required": True}, } _attribute_map = { - "download_url": {"key": "downloadUrl", "type": "str"}, - "expiration_time": {"key": "expirationTime", "type": "iso-8601"}, + "sku_id": {"key": "skuId", "type": "str"}, + "is_consented": {"key": "isConsented", "type": "bool"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, sku_id: str, is_consented: bool = False, **kwargs: Any) -> None: + """ + :keyword sku_id: The SKU id of the gallery application. Required. + :paramtype sku_id: str + :keyword is_consented: Whether the disclaimer of the gallery application is accepted. + :paramtype is_consented: bool + """ super().__init__(**kwargs) - self.download_url = None - self.expiration_time = None + self.sku_id = sku_id + self.is_consented = is_consented -class EmailEventListResult(_serialization.Model): - """A list of email events. +class GalleryAppListResult(_serialization.Model): + """A list of currently available gallery applications. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of email events. - :vartype value: list[~azure.mgmt.testbase.models.EmailEventResource] + :ivar value: The list of currently available gallery applications. + :vartype value: list[~azure.mgmt.testbase.models.GalleryAppResource] :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list of results. :vartype next_link: str @@ -1309,39 +3627,47 @@ class EmailEventListResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[EmailEventResource]"}, + "value": {"key": "value", "type": "[GalleryAppResource]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.EmailEventResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.GalleryAppResource"]] = None, **kwargs: Any) -> None: """ - :keyword value: The list of email events. - :paramtype value: list[~azure.mgmt.testbase.models.EmailEventResource] + :keyword value: The list of currently available gallery applications. + :paramtype value: list[~azure.mgmt.testbase.models.GalleryAppResource] """ super().__init__(**kwargs) self.value = value self.next_link = None -class EmailEventResource(ProxyResource): - """The email event resource. +class GalleryAppResource(ProxyResource): + """The gallery application resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system metadata relating to this resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.testbase.models.SystemData - :ivar event_id: The identifier of the email event. - :vartype event_id: str - :ivar event_name: The name of the email event. - :vartype event_name: str - :ivar display_name: The display name of the email event. - :vartype display_name: str + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.testbase.models.ProvisioningState + :ivar application_type: The application type of a gallery application. "Winget" + :vartype application_type: str or ~azure.mgmt.testbase.models.ApplicationType + :ivar application_id: The id of a gallery application. + :vartype application_id: str + :ivar application_name: The name of a gallery application. + :vartype application_name: str + :ivar popularity: The number of users using a gallery application. + :vartype popularity: int """ _validation = { @@ -1349,6 +3675,7 @@ class EmailEventResource(ProxyResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -1356,99 +3683,322 @@ class EmailEventResource(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "event_id": {"key": "properties.eventId", "type": "str"}, - "event_name": {"key": "properties.eventName", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "application_type": {"key": "properties.applicationType", "type": "str"}, + "application_id": {"key": "properties.applicationId", "type": "str"}, + "application_name": {"key": "properties.applicationName", "type": "str"}, + "popularity": {"key": "properties.popularity", "type": "int"}, } def __init__( self, *, - event_id: Optional[str] = None, - event_name: Optional[str] = None, - display_name: Optional[str] = None, - **kwargs - ): + application_type: Optional[Union[str, "_models.ApplicationType"]] = None, + application_id: Optional[str] = None, + application_name: Optional[str] = None, + popularity: int = 0, + **kwargs: Any + ) -> None: + """ + :keyword application_type: The application type of a gallery application. "Winget" + :paramtype application_type: str or ~azure.mgmt.testbase.models.ApplicationType + :keyword application_id: The id of a gallery application. + :paramtype application_id: str + :keyword application_name: The name of a gallery application. + :paramtype application_name: str + :keyword popularity: The number of users using a gallery application. + :paramtype popularity: int """ - :keyword event_id: The identifier of the email event. - :paramtype event_id: str - :keyword event_name: The name of the email event. - :paramtype event_name: str - :keyword display_name: The display name of the email event. - :paramtype display_name: str + super().__init__(**kwargs) + self.provisioning_state = None + self.application_type = application_type + self.application_id = application_id + self.application_name = application_name + self.popularity = popularity + + +class GalleryAppSkuListResult(_serialization.Model): + """A list of currently available SKUs of a gallery application. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of currently available SKUs of a gallery applications. + :vartype value: list[~azure.mgmt.testbase.models.GalleryAppSkuResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[GalleryAppSkuResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.GalleryAppSkuResource"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of currently available SKUs of a gallery applications. + :paramtype value: list[~azure.mgmt.testbase.models.GalleryAppSkuResource] """ super().__init__(**kwargs) - self.system_data = None - self.event_id = event_id - self.event_name = event_name - self.display_name = display_name + self.value = value + self.next_link = None -class ErrorDefinition(_serialization.Model): - """Error definition. +class GalleryAppSkuProperties(_serialization.Model): + """Properties of a gallery application SKU. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + WingetAppSkuProperties 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 target of the particular error. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.testbase.models.ErrorDefinition] + All required parameters must be populated in order to send to Azure. + + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.testbase.models.ProvisioningState + :ivar application_type: The application type of a gallery application. Required. "Winget" + :vartype application_type: str or ~azure.mgmt.testbase.models.ApplicationType """ _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "application_type": {"required": True}, } _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDefinition]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "application_type": {"key": "applicationType", "type": "str"}, } - def __init__(self, **kwargs): + _subtype_map = {"application_type": {"Winget": "WingetAppSkuProperties"}} + + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None + self.provisioning_state = None + self.application_type: Optional[str] = None -class ErrorResponse(_serialization.Model): - """The error response send when an operation fails. +class GalleryAppSkuResource(ProxyResource): + """The gallery application 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :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.testbase.models.SystemData + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.testbase.models.ProvisioningState + :ivar application_type: The application type of a gallery application. "Winget" + :vartype application_type: str or ~azure.mgmt.testbase.models.ApplicationType + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"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"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "application_type": {"key": "properties.applicationType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_state = None + self.application_type: Optional[str] = None + - :ivar error: The error details. - :vartype error: ~azure.mgmt.testbase.models.ErrorDefinition +class GenerateOperationParameters(_serialization.Model): + """Parameters body to pass to generate operation of Draft Package. + + :ivar force_generate: Force to generate package files even if no metadata changed. + :vartype force_generate: bool """ _attribute_map = { - "error": {"key": "error", "type": "ErrorDefinition"}, + "force_generate": {"key": "forceGenerate", "type": "bool"}, } - def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs): + def __init__(self, *, force_generate: bool = False, **kwargs: Any) -> None: """ - :keyword error: The error details. - :paramtype error: ~azure.mgmt.testbase.models.ErrorDefinition + :keyword force_generate: Force to generate package files even if no metadata changed. + :paramtype force_generate: bool """ super().__init__(**kwargs) - self.error = error + self.force_generate = force_generate -class FavoriteProcessListResult(_serialization.Model): - """A list of favorite processes for a package. +class GetFileUploadURLParameters(_serialization.Model): + """The parameters supplied to the Test Base Account GetFileUploadURL action. + + :ivar blob_name: The custom file name of the uploaded blob. + :vartype blob_name: str + :ivar resource_type: Resource type for file uploading. Known values are: "Package" and "VHD". + :vartype resource_type: str or ~azure.mgmt.testbase.models.FileUploadResourceType + """ + + _attribute_map = { + "blob_name": {"key": "blobName", "type": "str"}, + "resource_type": {"key": "resourceType", "type": "str"}, + } + + def __init__( + self, + *, + blob_name: Optional[str] = None, + resource_type: Optional[Union[str, "_models.FileUploadResourceType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword blob_name: The custom file name of the uploaded blob. + :paramtype blob_name: str + :keyword resource_type: Resource type for file uploading. Known values are: "Package" and + "VHD". + :paramtype resource_type: str or ~azure.mgmt.testbase.models.FileUploadResourceType + """ + super().__init__(**kwargs) + self.blob_name = blob_name + self.resource_type = resource_type + + +class GetImageDefinitionParameters(_serialization.Model): + """Parameters supplied to get the test base custom image Definition operation. + + :ivar definition_name: Image definition name. + :vartype definition_name: str + """ + + _attribute_map = { + "definition_name": {"key": "definitionName", "type": "str"}, + } + + def __init__(self, *, definition_name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword definition_name: Image definition name. + :paramtype definition_name: str + """ + super().__init__(**kwargs) + self.definition_name = definition_name + + +class HighlightedFile(_serialization.Model): + """The information of a highlighted file that user should pay attention to. + + All required parameters must be populated in order to send to Azure. + + :ivar path: The path of the highlighted file. Required. + :vartype path: str + :ivar visited: A flag to save whether this file is viewed by user. + :vartype visited: bool + :ivar sections: The name of sections to highlight. + :vartype sections: list[str] + """ + + _validation = { + "path": {"required": True}, + } + + _attribute_map = { + "path": {"key": "path", "type": "str"}, + "visited": {"key": "visited", "type": "bool"}, + "sections": {"key": "sections", "type": "[str]"}, + } + + def __init__( + self, *, path: str, visited: bool = False, sections: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword path: The path of the highlighted file. Required. + :paramtype path: str + :keyword visited: A flag to save whether this file is viewed by user. + :paramtype visited: bool + :keyword sections: The name of sections to highlight. + :paramtype sections: list[str] + """ + super().__init__(**kwargs) + self.path = path + self.visited = visited + self.sections = sections + + +class IdentifiedFailure(_serialization.Model): + """The failure identified. + + :ivar failure_id: The Failure Id. + :vartype failure_id: str + :ivar category: The category of the failure. Known values are: "None", "Unidentified", + "Package", "OSUpdate", and "Infrastructure". + :vartype category: str or ~azure.mgmt.testbase.models.Category + :ivar error_message: Message that shows information about the failure. + :vartype error_message: str + :ivar guidance: Guidance that shows what the customer needs to do for this failure. + :vartype guidance: str + """ + + _attribute_map = { + "failure_id": {"key": "failureId", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + "guidance": {"key": "guidance", "type": "str"}, + } + + def __init__( + self, + *, + failure_id: Optional[str] = None, + category: Optional[Union[str, "_models.Category"]] = None, + error_message: Optional[str] = None, + guidance: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword failure_id: The Failure Id. + :paramtype failure_id: str + :keyword category: The category of the failure. Known values are: "None", "Unidentified", + "Package", "OSUpdate", and "Infrastructure". + :paramtype category: str or ~azure.mgmt.testbase.models.Category + :keyword error_message: Message that shows information about the failure. + :paramtype error_message: str + :keyword guidance: Guidance that shows what the customer needs to do for this failure. + :paramtype guidance: str + """ + super().__init__(**kwargs) + self.failure_id = failure_id + self.category = category + self.error_message = error_message + self.guidance = guidance + + +class ImageDefinitionListResult(_serialization.Model): + """A list of test base image definitions. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of favorite processes for a package. - :vartype value: list[~azure.mgmt.testbase.models.FavoriteProcessResource] + :ivar value: The list of test base image definitions. + :vartype value: list[~azure.mgmt.testbase.models.ImageDefinitionResource] :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list of results. :vartype next_link: str @@ -1459,37 +4009,45 @@ class FavoriteProcessListResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[FavoriteProcessResource]"}, + "value": {"key": "value", "type": "[ImageDefinitionResource]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.FavoriteProcessResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.ImageDefinitionResource"]] = None, **kwargs: Any) -> None: """ - :keyword value: The list of favorite processes for a package. - :paramtype value: list[~azure.mgmt.testbase.models.FavoriteProcessResource] + :keyword value: The list of test base image definitions. + :paramtype value: list[~azure.mgmt.testbase.models.ImageDefinitionResource] """ super().__init__(**kwargs) self.value = value self.next_link = None -class FavoriteProcessResource(ProxyResource): - """A favorite process identifier. - +class ImageDefinitionResource(ProxyResource): + """The test base image definition resource. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system metadata relating to this resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.testbase.models.SystemData - :ivar actual_process_name: The actual name of the favorite process. It will be equal to - resource name except for the scenario that the process name contains characters that are not - allowed in the resource name. - :vartype actual_process_name: str + :ivar architecture: Custom image architecture. "x64" + :vartype architecture: str or ~azure.mgmt.testbase.models.ImageArchitecture + :ivar os_state: Custom image OS state. Known values are: "Generalized" and "Specialized". + :vartype os_state: str or ~azure.mgmt.testbase.models.ImageOSState + :ivar security_type: Custom image security type. Known values are: "Standard" and + "TrustedLaunch". + :vartype security_type: str or ~azure.mgmt.testbase.models.ImageSecurityType + :ivar provisioning_state: + :vartype provisioning_state: str """ _validation = { @@ -1497,6 +4055,7 @@ class FavoriteProcessResource(ProxyResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -1504,190 +4063,324 @@ class FavoriteProcessResource(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "actual_process_name": {"key": "properties.actualProcessName", "type": "str"}, + "architecture": {"key": "properties.architecture", "type": "str"}, + "os_state": {"key": "properties.osState", "type": "str"}, + "security_type": {"key": "properties.securityType", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - def __init__(self, *, actual_process_name: Optional[str] = None, **kwargs): - """ - :keyword actual_process_name: The actual name of the favorite process. It will be equal to - resource name except for the scenario that the process name contains characters that are not - allowed in the resource name. - :paramtype actual_process_name: str + def __init__( + self, + *, + architecture: Optional[Union[str, "_models.ImageArchitecture"]] = None, + os_state: Optional[Union[str, "_models.ImageOSState"]] = None, + security_type: Optional[Union[str, "_models.ImageSecurityType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword architecture: Custom image architecture. "x64" + :paramtype architecture: str or ~azure.mgmt.testbase.models.ImageArchitecture + :keyword os_state: Custom image OS state. Known values are: "Generalized" and "Specialized". + :paramtype os_state: str or ~azure.mgmt.testbase.models.ImageOSState + :keyword security_type: Custom image security type. Known values are: "Standard" and + "TrustedLaunch". + :paramtype security_type: str or ~azure.mgmt.testbase.models.ImageSecurityType """ super().__init__(**kwargs) - self.system_data = None - self.actual_process_name = actual_process_name + self.architecture = architecture + self.os_state = os_state + self.security_type = security_type + self.provisioning_state = None -class FileUploadURLResponse(_serialization.Model): - """The URL response. +class ImageDefinitionsListResult(_serialization.Model): + """The result of all available image definition under a test base account. Variables are only populated by the server, and will be ignored when sending a request. - :ivar upload_url: The URL used for uploading the package. - :vartype upload_url: str - :ivar blob_path: The blob path of the uploaded package. It will be used as the 'blobPath' - property of PackageResource. - :vartype blob_path: str + :ivar value: The list of image definitions. + :vartype value: list[~azure.mgmt.testbase.models.ImageDefinitionResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str """ _validation = { - "upload_url": {"readonly": True}, - "blob_path": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - "upload_url": {"key": "uploadUrl", "type": "str"}, - "blob_path": {"key": "blobPath", "type": "str"}, + "value": {"key": "value", "type": "[ImageDefinitionResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, value: Optional[List["_models.ImageDefinitionResource"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of image definitions. + :paramtype value: list[~azure.mgmt.testbase.models.ImageDefinitionResource] + """ super().__init__(**kwargs) - self.upload_url = None - self.blob_path = None + self.value = value + self.next_link = None -class FlightingRingListResult(_serialization.Model): - """A list of flighting rings. +class ImageNameCheckAvailabilityParameters(_serialization.Model): + """Parameter body to request test base custom image availability. - 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. - :ivar value: The list of flighting rings. - :vartype value: list[~azure.mgmt.testbase.models.FlightingRingResource] - :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list - of results. - :vartype next_link: str + :ivar definition_name: Image definition name. Required. + :vartype definition_name: str + :ivar version_name: Image version name. Required. + :vartype version_name: str """ _validation = { - "next_link": {"readonly": True}, + "definition_name": {"required": True}, + "version_name": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[FlightingRingResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "definition_name": {"key": "definitionName", "type": "str"}, + "version_name": {"key": "versionName", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.FlightingRingResource"]] = None, **kwargs): + def __init__(self, *, definition_name: str, version_name: str, **kwargs: Any) -> None: """ - :keyword value: The list of flighting rings. - :paramtype value: list[~azure.mgmt.testbase.models.FlightingRingResource] + :keyword definition_name: Image definition name. Required. + :paramtype definition_name: str + :keyword version_name: Image version name. Required. + :paramtype version_name: str """ super().__init__(**kwargs) - self.value = value - self.next_link = None + self.definition_name = definition_name + self.version_name = version_name -class FlightingRingResource(ProxyResource): - """The flighting ring resource. - - Variables are only populated by the server, and will be ignored when sending a request. +class ImageValidationResults(_serialization.Model): + """The image validation result. - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.testbase.models.SystemData - :ivar actual_flighting_ring_name: The actual name of a flighting ring of a Test Base Account. - :vartype actual_flighting_ring_name: str + :ivar results: The validation results of the image. + :vartype results: list[~azure.mgmt.testbase.models.VerificationResult] """ - _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"}, - "actual_flighting_ring_name": {"key": "properties.actualFlightingRingName", "type": "str"}, + "results": {"key": "results", "type": "[VerificationResult]"}, } - def __init__(self, *, actual_flighting_ring_name: Optional[str] = None, **kwargs): + def __init__(self, *, results: Optional[List["_models.VerificationResult"]] = None, **kwargs: Any) -> None: """ - :keyword actual_flighting_ring_name: The actual name of a flighting ring of a Test Base - Account. - :paramtype actual_flighting_ring_name: str + :keyword results: The validation results of the image. + :paramtype results: list[~azure.mgmt.testbase.models.VerificationResult] """ super().__init__(**kwargs) - self.system_data = None - self.actual_flighting_ring_name = actual_flighting_ring_name + self.results = results -class GetFileUploadURLParameters(_serialization.Model): - """The parameters supplied to the Test Base Account GetFileUploadURL action. +class InplaceUpgradeOSInfo(_serialization.Model): + """Specifies the baseline os and target os for in-place upgrade tests. - :ivar blob_name: The custom file name of the uploaded blob. - :vartype blob_name: str + :ivar baseline_os: Specifies the baseline os for in-place upgrade tests. + :vartype baseline_os: ~azure.mgmt.testbase.models.OsProperties + :ivar target_os: Specifies the target os for in-place upgrade tests. + :vartype target_os: str """ _attribute_map = { - "blob_name": {"key": "blobName", "type": "str"}, + "baseline_os": {"key": "baselineOS", "type": "OsProperties"}, + "target_os": {"key": "targetOS", "type": "str"}, } - def __init__(self, *, blob_name: Optional[str] = None, **kwargs): + def __init__( + self, *, baseline_os: Optional["_models.OsProperties"] = None, target_os: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword blob_name: The custom file name of the uploaded blob. - :paramtype blob_name: str + :keyword baseline_os: Specifies the baseline os for in-place upgrade tests. + :paramtype baseline_os: ~azure.mgmt.testbase.models.OsProperties + :keyword target_os: Specifies the target os for in-place upgrade tests. + :paramtype target_os: str """ super().__init__(**kwargs) - self.blob_name = blob_name + self.baseline_os = baseline_os + self.target_os = target_os + + +class InplaceUpgradeProperties(_serialization.Model): + """Properties for in-place upgrade test result. + + :ivar upgrade_start_time: Time stamp for os upgrading start (UTC). + :vartype upgrade_start_time: ~datetime.datetime + :ivar upgrade_end_time: Time stamp for os upgrading end (UTC). + :vartype upgrade_end_time: ~datetime.datetime + :ivar custom_image_id: Specify the referenced Test Base Custom Image Id if applicable. + :vartype custom_image_id: str + :ivar custom_image_display_name: The name of the custom image resource. + :vartype custom_image_display_name: str + :ivar baseline_os_name: The name of the OS. + :vartype baseline_os_name: str + :ivar baseline_release_name: The name of the baseline OS release. + :vartype baseline_release_name: str + :ivar baseline_build_number: The build number of the baseline OS release. + :vartype baseline_build_number: str + :ivar baseline_build_revision: The build revision of the baseline OS release. + :vartype baseline_build_revision: str + :ivar baseline_kb_number: The kb number of the baseline OS release. + :vartype baseline_kb_number: str + :ivar baseline_release_version_date: The release version date of the baseline OS release. + :vartype baseline_release_version_date: ~datetime.datetime + """ + + _attribute_map = { + "upgrade_start_time": {"key": "upgradeStartTime", "type": "iso-8601"}, + "upgrade_end_time": {"key": "upgradeEndTime", "type": "iso-8601"}, + "custom_image_id": {"key": "customImageId", "type": "str"}, + "custom_image_display_name": {"key": "customImageDisplayName", "type": "str"}, + "baseline_os_name": {"key": "baselineOsName", "type": "str"}, + "baseline_release_name": {"key": "baselineReleaseName", "type": "str"}, + "baseline_build_number": {"key": "baselineBuildNumber", "type": "str"}, + "baseline_build_revision": {"key": "baselineBuildRevision", "type": "str"}, + "baseline_kb_number": {"key": "baselineKbNumber", "type": "str"}, + "baseline_release_version_date": {"key": "baselineReleaseVersionDate", "type": "iso-8601"}, + } + def __init__( + self, + *, + upgrade_start_time: Optional[datetime.datetime] = None, + upgrade_end_time: Optional[datetime.datetime] = None, + custom_image_id: Optional[str] = None, + custom_image_display_name: Optional[str] = None, + baseline_os_name: Optional[str] = None, + baseline_release_name: Optional[str] = None, + baseline_build_number: Optional[str] = None, + baseline_build_revision: Optional[str] = None, + baseline_kb_number: Optional[str] = None, + baseline_release_version_date: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword upgrade_start_time: Time stamp for os upgrading start (UTC). + :paramtype upgrade_start_time: ~datetime.datetime + :keyword upgrade_end_time: Time stamp for os upgrading end (UTC). + :paramtype upgrade_end_time: ~datetime.datetime + :keyword custom_image_id: Specify the referenced Test Base Custom Image Id if applicable. + :paramtype custom_image_id: str + :keyword custom_image_display_name: The name of the custom image resource. + :paramtype custom_image_display_name: str + :keyword baseline_os_name: The name of the OS. + :paramtype baseline_os_name: str + :keyword baseline_release_name: The name of the baseline OS release. + :paramtype baseline_release_name: str + :keyword baseline_build_number: The build number of the baseline OS release. + :paramtype baseline_build_number: str + :keyword baseline_build_revision: The build revision of the baseline OS release. + :paramtype baseline_build_revision: str + :keyword baseline_kb_number: The kb number of the baseline OS release. + :paramtype baseline_kb_number: str + :keyword baseline_release_version_date: The release version date of the baseline OS release. + :paramtype baseline_release_version_date: ~datetime.datetime + """ + super().__init__(**kwargs) + self.upgrade_start_time = upgrade_start_time + self.upgrade_end_time = upgrade_end_time + self.custom_image_id = custom_image_id + self.custom_image_display_name = custom_image_display_name + self.baseline_os_name = baseline_os_name + self.baseline_release_name = baseline_release_name + self.baseline_build_number = baseline_build_number + self.baseline_build_revision = baseline_build_revision + self.baseline_kb_number = baseline_kb_number + self.baseline_release_version_date = baseline_release_version_date + + +class IntuneEnrollmentMetadata(_serialization.Model): + """The metadata of Intune enrollment. + + :ivar app_list: The enrolled Intune apps. + :vartype app_list: list[~azure.mgmt.testbase.models.EnrolledIntuneApp] + :ivar credential_id: The id of the Intune enrollment credential. + :vartype credential_id: str + :ivar expected_deployment_duration_in_minute: The expected duration of Intune applications and + policies deployment. + :vartype expected_deployment_duration_in_minute: int + """ -class IdentifiedFailure(_serialization.Model): - """The failure identified. + _attribute_map = { + "app_list": {"key": "appList", "type": "[EnrolledIntuneApp]"}, + "credential_id": {"key": "credentialId", "type": "str"}, + "expected_deployment_duration_in_minute": {"key": "expectedDeploymentDurationInMinute", "type": "int"}, + } - :ivar failure_id: The Failure Id. - :vartype failure_id: str - :ivar category: The category of the failure. Known values are: "None", "Unidentified", - "Package", "OSUpdate", and "Infrastructure". - :vartype category: str or ~azure.mgmt.testbase.models.Category - :ivar error_message: Message that shows information about the failure. - :vartype error_message: str - :ivar guidance: Guidance that shows what the customer needs to do for this failure. - :vartype guidance: str + def __init__( + self, + *, + app_list: Optional[List["_models.EnrolledIntuneApp"]] = None, + credential_id: Optional[str] = None, + expected_deployment_duration_in_minute: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword app_list: The enrolled Intune apps. + :paramtype app_list: list[~azure.mgmt.testbase.models.EnrolledIntuneApp] + :keyword credential_id: The id of the Intune enrollment credential. + :paramtype credential_id: str + :keyword expected_deployment_duration_in_minute: The expected duration of Intune applications + and policies deployment. + :paramtype expected_deployment_duration_in_minute: int + """ + super().__init__(**kwargs) + self.app_list = app_list + self.credential_id = credential_id + self.expected_deployment_duration_in_minute = expected_deployment_duration_in_minute + + +class IntuneSingletonResourceProperties(CredentialProperties): + """The properties of intune credential. + + All required parameters must be populated in order to send to Azure. + + :ivar credential_type: Credential type. Required. "IntuneAccount" + :vartype credential_type: str or ~azure.mgmt.testbase.models.CredentialType + :ivar display_name: Credential display name. Required. + :vartype display_name: str + :ivar user_name_key_vault_secret_path: The key vault secret path of user name. + :vartype user_name_key_vault_secret_path: str + :ivar password_key_vault_secret_path: The key vault secret path of password. + :vartype password_key_vault_secret_path: str """ + _validation = { + "credential_type": {"required": True}, + "display_name": {"required": True}, + } + _attribute_map = { - "failure_id": {"key": "failureId", "type": "str"}, - "category": {"key": "category", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "guidance": {"key": "guidance", "type": "str"}, + "credential_type": {"key": "credentialType", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "user_name_key_vault_secret_path": {"key": "userNameKeyVaultSecretPath", "type": "str"}, + "password_key_vault_secret_path": {"key": "passwordKeyVaultSecretPath", "type": "str"}, } def __init__( self, *, - failure_id: Optional[str] = None, - category: Optional[Union[str, "_models.Category"]] = None, - error_message: Optional[str] = None, - guidance: Optional[str] = None, - **kwargs - ): + display_name: str, + user_name_key_vault_secret_path: Optional[str] = None, + password_key_vault_secret_path: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword failure_id: The Failure Id. - :paramtype failure_id: str - :keyword category: The category of the failure. Known values are: "None", "Unidentified", - "Package", "OSUpdate", and "Infrastructure". - :paramtype category: str or ~azure.mgmt.testbase.models.Category - :keyword error_message: Message that shows information about the failure. - :paramtype error_message: str - :keyword guidance: Guidance that shows what the customer needs to do for this failure. - :paramtype guidance: str + :keyword display_name: Credential display name. Required. + :paramtype display_name: str + :keyword user_name_key_vault_secret_path: The key vault secret path of user name. + :paramtype user_name_key_vault_secret_path: str + :keyword password_key_vault_secret_path: The key vault secret path of password. + :paramtype password_key_vault_secret_path: str """ - super().__init__(**kwargs) - self.failure_id = failure_id - self.category = category - self.error_message = error_message - self.guidance = guidance + super().__init__(display_name=display_name, **kwargs) + self.credential_type: str = "IntuneAccount" + self.user_name_key_vault_secret_path = user_name_key_vault_secret_path + self.password_key_vault_secret_path = password_key_vault_secret_path class MemoryRegressionResultSingletonResourceProperties(AnalysisResultSingletonResourceProperties): @@ -1695,8 +4388,8 @@ class MemoryRegressionResultSingletonResourceProperties(AnalysisResultSingletonR All required parameters must be populated in order to send to Azure. - :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", "Fail", + and "Pass". :vartype grade: str or ~azure.mgmt.testbase.models.Grade :ivar analysis_result_type: Type of the Analysis Result. Required. Known values are: "ScriptExecution", "Reliability", "CPUUtilization", "MemoryUtilization", "CPURegression", @@ -1721,17 +4414,17 @@ def __init__( *, grade: Optional[Union[str, "_models.Grade"]] = None, memory_regression_results: Optional[List["_models.RegressionResult"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", + "Fail", and "Pass". :paramtype grade: str or ~azure.mgmt.testbase.models.Grade :keyword memory_regression_results: The result array data. :paramtype memory_regression_results: list[~azure.mgmt.testbase.models.RegressionResult] """ super().__init__(grade=grade, **kwargs) - self.analysis_result_type = "MemoryRegression" # type: str + self.analysis_result_type: str = "MemoryRegression" self.memory_regression_results = memory_regression_results @@ -1740,8 +4433,8 @@ class MemoryUtilizationResultSingletonResourceProperties(AnalysisResultSingleton All required parameters must be populated in order to send to Azure. - :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", "Fail", + and "Pass". :vartype grade: str or ~azure.mgmt.testbase.models.Grade :ivar analysis_result_type: Type of the Analysis Result. Required. Known values are: "ScriptExecution", "Reliability", "CPUUtilization", "MemoryUtilization", "CPURegression", @@ -1766,17 +4459,17 @@ def __init__( *, grade: Optional[Union[str, "_models.Grade"]] = None, memory_utilization_results: Optional[List["_models.UtilizationResult"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", + "Fail", and "Pass". :paramtype grade: str or ~azure.mgmt.testbase.models.Grade :keyword memory_utilization_results: The result array data. :paramtype memory_utilization_results: list[~azure.mgmt.testbase.models.UtilizationResult] """ super().__init__(grade=grade, **kwargs) - self.analysis_result_type = "MemoryUtilization" # type: str + self.analysis_result_type: str = "MemoryUtilization" self.memory_utilization_results = memory_utilization_results @@ -1799,8 +4492,8 @@ def __init__( *, receiver_type: Optional[str] = None, receiver_value: Optional["_models.NotificationReceiverValue"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword receiver_type: The type of the notification event receiver. :paramtype receiver_type: str @@ -1839,8 +4532,8 @@ def __init__( user_object_receiver_value: Optional["_models.UserObjectReceiverValue"] = None, subscription_receiver_value: Optional["_models.SubscriptionReceiverValue"] = None, distribution_group_list_receiver_value: Optional["_models.DistributionGroupListReceiverValue"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword user_object_receiver_value: The user object receiver value. :paramtype user_object_receiver_value: ~azure.mgmt.testbase.models.UserObjectReceiverValue @@ -1857,103 +4550,111 @@ def __init__( class Operation(_serialization.Model): - """REST API operation. + """Details of a REST API operation, returned from the Resource Provider Operations API. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Operation name: {provider}/{resource}/{operation}. + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". :vartype name: str - :ivar is_data_action: Indicates whether the operation is a data action. + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. :vartype is_data_action: bool - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar display: The object that describes the operation. + :ivar display: Localized display information for this particular operation. :vartype display: ~azure.mgmt.testbase.models.OperationDisplay - :ivar properties: Extra properties of the operation. - :vartype properties: JSON + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.testbase.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.testbase.models.ActionType """ _validation = { "name": {"readonly": True}, "is_data_action": {"readonly": True}, "origin": {"readonly": True}, + "action_type": {"readonly": True}, } _attribute_map = { "name": {"key": "name", "type": "str"}, "is_data_action": {"key": "isDataAction", "type": "bool"}, - "origin": {"key": "origin", "type": "str"}, "display": {"key": "display", "type": "OperationDisplay"}, - "properties": {"key": "properties", "type": "object"}, + "origin": {"key": "origin", "type": "str"}, + "action_type": {"key": "actionType", "type": "str"}, } - def __init__( - self, *, display: Optional["_models.OperationDisplay"] = None, properties: Optional[JSON] = None, **kwargs - ): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ - :keyword display: The object that describes the operation. + :keyword display: Localized display information for this particular operation. :paramtype display: ~azure.mgmt.testbase.models.OperationDisplay - :keyword properties: Extra properties of the operation. - :paramtype properties: JSON """ super().__init__(**kwargs) self.name = None self.is_data_action = None - self.origin = None self.display = display - self.properties = properties + self.origin = None + self.action_type = None class OperationDisplay(_serialization.Model): - """The object that describes the operation. + """Localized display information for this particular operation. Variables are only populated by the server, and will be ignored when sending a request. - :ivar provider: The resource provider name: Microsoft.TestBase. + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". :vartype provider: str - :ivar operation: Operation type: read, write, delete, listPackages, etc. - :vartype operation: str - :ivar resource: Resource type on which the operation is performed. + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". :vartype resource: str - :ivar description: Friendly name of the operation. + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. :vartype description: str """ _validation = { "provider": {"readonly": True}, - "operation": {"readonly": True}, "resource": {"readonly": True}, + "operation": {"readonly": True}, "description": {"readonly": True}, } _attribute_map = { "provider": {"key": "provider", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None - self.operation = None self.resource = None + self.operation = None self.description = None class OperationListResult(_serialization.Model): - """A list of operations supported by the resource provider. + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of operations supported by the Test Base resource provider. + :ivar value: List of operations supported by the resource provider. :vartype value: list[~azure.mgmt.testbase.models.Operation] - :ivar next_link: URL to get the next set of operation list results if there are any. + :ivar next_link: URL to get the next set of operation list results (if there are any). :vartype next_link: str """ _validation = { + "value": {"readonly": True}, "next_link": {"readonly": True}, } @@ -1962,14 +4663,60 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwargs): + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class OsProperties(_serialization.Model): + """The properties of an operating system. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar os_name: The name of the OS. + :vartype os_name: str + :ivar custom_image_id: Specify the referenced Test Base Custom Image Id if available. + :vartype custom_image_id: str + :ivar custom_image_display_name: The name of the custom image resource. + :vartype custom_image_display_name: str + :ivar release_properties: The properties of the OS release. + :vartype release_properties: ~azure.mgmt.testbase.models.ReleaseProperties + """ + + _validation = { + "custom_image_display_name": {"readonly": True}, + } + + _attribute_map = { + "os_name": {"key": "osName", "type": "str"}, + "custom_image_id": {"key": "customImageId", "type": "str"}, + "custom_image_display_name": {"key": "customImageDisplayName", "type": "str"}, + "release_properties": {"key": "releaseProperties", "type": "ReleaseProperties"}, + } + + def __init__( + self, + *, + os_name: Optional[str] = None, + custom_image_id: Optional[str] = None, + release_properties: Optional["_models.ReleaseProperties"] = None, + **kwargs: Any + ) -> None: """ - :keyword value: List of operations supported by the Test Base resource provider. - :paramtype value: list[~azure.mgmt.testbase.models.Operation] + :keyword os_name: The name of the OS. + :paramtype os_name: str + :keyword custom_image_id: Specify the referenced Test Base Custom Image Id if available. + :paramtype custom_image_id: str + :keyword release_properties: The properties of the OS release. + :paramtype release_properties: ~azure.mgmt.testbase.models.ReleaseProperties """ super().__init__(**kwargs) - self.value = value - self.next_link = None + self.os_name = os_name + self.custom_image_id = custom_image_id + self.custom_image_display_name = None + self.release_properties = release_properties class OSUpdateListResult(_serialization.Model): @@ -1993,7 +4740,7 @@ class OSUpdateListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.OSUpdateResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.OSUpdateResource"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of OS Updates. :paramtype value: list[~azure.mgmt.testbase.models.OSUpdateResource] @@ -2008,13 +4755,16 @@ class OSUpdateResource(ProxyResource): # pylint: disable=too-many-instance-attr Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system metadata relating to this resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.testbase.models.SystemData :ivar os_name: The name of the OS. :vartype os_name: str @@ -2027,10 +4777,17 @@ class OSUpdateResource(ProxyResource): # pylint: disable=too-many-instance-attr :ivar build_revision: The build revision of the tested release (OS update). :vartype build_revision: str :ivar type_properties_type: The type of this release (OS update). Known values are: - "SecurityUpdate" and "FeatureUpdate". + "SecurityUpdate", "FeatureUpdate", and "InplaceUpgrade". :vartype type_properties_type: str or ~azure.mgmt.testbase.models.Type :ivar release_version_date: The release version date the tested release (OS update). :vartype release_version_date: ~datetime.datetime + :ivar inplace_upgrade_baseline_properties: The properties of baseline os for in-place upgrade + test. + :vartype inplace_upgrade_baseline_properties: ~azure.mgmt.testbase.models.OsProperties + :ivar custom_image_id: Specify the referenced Test Base Custom Image Id if available. + :vartype custom_image_id: str + :ivar custom_image_display_name: The name of the custom image resource. + :vartype custom_image_display_name: str """ _validation = { @@ -2052,6 +4809,12 @@ class OSUpdateResource(ProxyResource): # pylint: disable=too-many-instance-attr "build_revision": {"key": "properties.buildRevision", "type": "str"}, "type_properties_type": {"key": "properties.type", "type": "str"}, "release_version_date": {"key": "properties.releaseVersionDate", "type": "iso-8601"}, + "inplace_upgrade_baseline_properties": { + "key": "properties.inplaceUpgradeBaselineProperties", + "type": "OsProperties", + }, + "custom_image_id": {"key": "properties.customImageId", "type": "str"}, + "custom_image_display_name": {"key": "properties.customImageDisplayName", "type": "str"}, } def __init__( @@ -2064,8 +4827,11 @@ def __init__( build_revision: Optional[str] = None, type_properties_type: Optional[Union[str, "_models.Type"]] = None, release_version_date: Optional[datetime.datetime] = None, - **kwargs - ): + inplace_upgrade_baseline_properties: Optional["_models.OsProperties"] = None, + custom_image_id: Optional[str] = None, + custom_image_display_name: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword os_name: The name of the OS. :paramtype os_name: str @@ -2078,13 +4844,19 @@ def __init__( :keyword build_revision: The build revision of the tested release (OS update). :paramtype build_revision: str :keyword type_properties_type: The type of this release (OS update). Known values are: - "SecurityUpdate" and "FeatureUpdate". + "SecurityUpdate", "FeatureUpdate", and "InplaceUpgrade". :paramtype type_properties_type: str or ~azure.mgmt.testbase.models.Type :keyword release_version_date: The release version date the tested release (OS update). :paramtype release_version_date: ~datetime.datetime + :keyword inplace_upgrade_baseline_properties: The properties of baseline os for in-place + upgrade test. + :paramtype inplace_upgrade_baseline_properties: ~azure.mgmt.testbase.models.OsProperties + :keyword custom_image_id: Specify the referenced Test Base Custom Image Id if available. + :paramtype custom_image_id: str + :keyword custom_image_display_name: The name of the custom image resource. + :paramtype custom_image_display_name: str """ super().__init__(**kwargs) - self.system_data = None self.os_name = os_name self.release = release self.flighting_ring = flighting_ring @@ -2092,6 +4864,9 @@ def __init__( self.build_revision = build_revision self.type_properties_type = type_properties_type self.release_version_date = release_version_date + self.inplace_upgrade_baseline_properties = inplace_upgrade_baseline_properties + self.custom_image_id = custom_image_id + self.custom_image_display_name = custom_image_display_name class OSUpdatesTestSummary(_serialization.Model): @@ -2104,8 +4879,8 @@ class OSUpdatesTestSummary(_serialization.Model): "TestExecutionInProgress", "DataProcessing", "TestFailure", "UpdateFailure", "TestAndUpdateFailure", "InfrastructureFailure", and "Completed". :vartype test_status: str or ~azure.mgmt.testbase.models.TestStatus - :ivar grade: The grade of last test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :ivar grade: The grade of last test. Known values are: "None", "NotAvailable", "Pass", "Fail", + and "Pass". :vartype grade: str or ~azure.mgmt.testbase.models.Grade :ivar test_run_time: The run time of the last test. :vartype test_run_time: str @@ -2129,8 +4904,8 @@ def __init__( grade: Optional[Union[str, "_models.Grade"]] = None, test_run_time: Optional[str] = None, os_update_test_summaries: Optional[List["_models.OSUpdateTestSummary"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword execution_status: The status of the last test. Known values are: "None", "InProgress", "Processing", "Completed", "NotExecuted", "Incomplete", "Failed", and "Succeeded". @@ -2139,8 +4914,8 @@ def __init__( "TestExecutionInProgress", "DataProcessing", "TestFailure", "UpdateFailure", "TestAndUpdateFailure", "InfrastructureFailure", and "Completed". :paramtype test_status: str or ~azure.mgmt.testbase.models.TestStatus - :keyword grade: The grade of last test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :keyword grade: The grade of last test. Known values are: "None", "NotAvailable", "Pass", + "Fail", and "Pass". :paramtype grade: str or ~azure.mgmt.testbase.models.Grade :keyword test_run_time: The run time of the last test. :paramtype test_run_time: str @@ -2160,6 +4935,10 @@ class OSUpdateTestSummary(_serialization.Model): # pylint: disable=too-many-ins :ivar os_name: The operating system name. e.g. Windows 10 1809. :vartype os_name: str + :ivar custom_image_id: Specify the referenced Test Base Custom Image Id if available. + :vartype custom_image_id: str + :ivar custom_image_display_name: The name of the custom image resource. + :vartype custom_image_display_name: str :ivar release_name: The name of the tested release (OS update). :vartype release_name: str :ivar build_version: The build version of the tested release (OS update). @@ -2178,17 +4957,22 @@ class OSUpdateTestSummary(_serialization.Model): # pylint: disable=too-many-ins "DataProcessing", "TestFailure", "UpdateFailure", "TestAndUpdateFailure", "InfrastructureFailure", and "Completed". :vartype test_status: str or ~azure.mgmt.testbase.models.TestStatus - :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", "Fail", + and "Pass". :vartype grade: str or ~azure.mgmt.testbase.models.Grade :ivar test_run_time: The run time of the test. :vartype test_run_time: str :ivar test_type: The test type of the package. :vartype test_type: str + :ivar inplace_upgrade_baseline_properties: The properties of baseline os for in-place upgrade + test. + :vartype inplace_upgrade_baseline_properties: ~azure.mgmt.testbase.models.OsProperties """ _attribute_map = { "os_name": {"key": "osName", "type": "str"}, + "custom_image_id": {"key": "customImageId", "type": "str"}, + "custom_image_display_name": {"key": "customImageDisplayName", "type": "str"}, "release_name": {"key": "releaseName", "type": "str"}, "build_version": {"key": "buildVersion", "type": "str"}, "build_revision": {"key": "buildRevision", "type": "str"}, @@ -2199,12 +4983,15 @@ class OSUpdateTestSummary(_serialization.Model): # pylint: disable=too-many-ins "grade": {"key": "grade", "type": "str"}, "test_run_time": {"key": "testRunTime", "type": "str"}, "test_type": {"key": "testType", "type": "str"}, + "inplace_upgrade_baseline_properties": {"key": "inplaceUpgradeBaselineProperties", "type": "OsProperties"}, } def __init__( self, *, os_name: Optional[str] = None, + custom_image_id: Optional[str] = None, + custom_image_display_name: Optional[str] = None, release_name: Optional[str] = None, build_version: Optional[str] = None, build_revision: Optional[str] = None, @@ -2215,11 +5002,16 @@ def __init__( grade: Optional[Union[str, "_models.Grade"]] = None, test_run_time: Optional[str] = None, test_type: Optional[str] = None, - **kwargs - ): + inplace_upgrade_baseline_properties: Optional["_models.OsProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword os_name: The operating system name. e.g. Windows 10 1809. :paramtype os_name: str + :keyword custom_image_id: Specify the referenced Test Base Custom Image Id if available. + :paramtype custom_image_id: str + :keyword custom_image_display_name: The name of the custom image resource. + :paramtype custom_image_display_name: str :keyword release_name: The name of the tested release (OS update). :paramtype release_name: str :keyword build_version: The build version of the tested release (OS update). @@ -2238,16 +5030,21 @@ def __init__( "TestExecutionInProgress", "DataProcessing", "TestFailure", "UpdateFailure", "TestAndUpdateFailure", "InfrastructureFailure", and "Completed". :paramtype test_status: str or ~azure.mgmt.testbase.models.TestStatus - :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", + "Fail", and "Pass". :paramtype grade: str or ~azure.mgmt.testbase.models.Grade :keyword test_run_time: The run time of the test. :paramtype test_run_time: str :keyword test_type: The test type of the package. :paramtype test_type: str + :keyword inplace_upgrade_baseline_properties: The properties of baseline os for in-place + upgrade test. + :paramtype inplace_upgrade_baseline_properties: ~azure.mgmt.testbase.models.OsProperties """ super().__init__(**kwargs) self.os_name = os_name + self.custom_image_id = custom_image_id + self.custom_image_display_name = custom_image_display_name self.release_name = release_name self.build_version = build_version self.build_revision = build_revision @@ -2258,6 +5055,7 @@ def __init__( self.grade = grade self.test_run_time = test_run_time self.test_type = test_type + self.inplace_upgrade_baseline_properties = inplace_upgrade_baseline_properties class PackageCheckNameAvailabilityParameters(_serialization.Model): @@ -2288,7 +5086,9 @@ class PackageCheckNameAvailabilityParameters(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: str, application_name: str, version: str, type: Optional[str] = None, **kwargs): + def __init__( + self, *, name: str, application_name: str, version: str, type: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword name: Resource name to verify. Required. :paramtype name: str @@ -2327,7 +5127,7 @@ class PackageListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.PackageResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PackageResource"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Test Base Packages. :paramtype value: list[~azure.mgmt.testbase.models.PackageResource] @@ -2338,46 +5138,50 @@ def __init__(self, *, value: Optional[List["_models.PackageResource"]] = None, * class TrackedResource(Resource): - """The resource model definition for an ARM tracked top level 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 Azure. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar tags: The tags of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.testbase.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 etag: Resource Etag. - :vartype etag: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, "location": {"required": True}, - "etag": {"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}"}, "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str @@ -2385,7 +5189,6 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw super().__init__(**kwargs) self.tags = tags self.location = location - self.etag = None class PackageResource(TrackedResource): # pylint: disable=too-many-instance-attributes @@ -2395,20 +5198,21 @@ class PackageResource(TrackedResource): # pylint: disable=too-many-instance-att All required parameters must be populated in order to send to Azure. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar tags: The tags of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.testbase.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 etag: Resource Etag. - :vartype etag: str - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.testbase.models.SystemData :ivar provisioning_state: The provisioning state of the resource. Known values are: "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.testbase.models.ProvisioningState @@ -2416,18 +5220,13 @@ class PackageResource(TrackedResource): # pylint: disable=too-many-instance-att :vartype application_name: str :ivar version: Application version. :vartype version: str - :ivar test_types: OOB, functional or both. Mapped to the data in 'tests' property. - :vartype test_types: list[str or ~azure.mgmt.testbase.models.TestType] - :ivar target_os_list: Specifies the target OSs of specific OS Update types. - :vartype target_os_list: list[~azure.mgmt.testbase.models.TargetOSInfo] + :ivar draft_package_id: The id of draft package. Used to create or update this package from a + draft package. + :vartype draft_package_id: str :ivar package_status: The status of the package. Known values are: "Unknown", "Registered", "Ready", "Error", "ValidatingPackage", "PreValidationCheckPass", "Deleted", "ValidationLongerThanUsual", and "VerifyingPackage". :vartype package_status: str or ~azure.mgmt.testbase.models.PackageStatus - :ivar last_modified_time: The UTC timestamp when the package was last modified. - :vartype last_modified_time: ~datetime.datetime - :ivar flighting_ring: The flighting ring for feature update. - :vartype flighting_ring: str :ivar is_enabled: Flag showing that whether the package is enabled. It doesn't schedule test for package which is not enabled. :vartype is_enabled: bool @@ -2436,45 +5235,69 @@ class PackageResource(TrackedResource): # pylint: disable=too-many-instance-att :ivar validation_results: The validation results. There's validation on package when it's created or updated. :vartype validation_results: list[~azure.mgmt.testbase.models.PackageValidationResult] + :ivar test_types: OOB, functional or flow driven. Mapped to the data in 'tests' property. + :vartype test_types: list[str or ~azure.mgmt.testbase.models.TestType] + :ivar target_os_list: Specifies the target OSs of specific OS Update types. + :vartype target_os_list: list[~azure.mgmt.testbase.models.TargetOSInfo] + :ivar inplace_upgrade_os_pair: Specifies the baseline os and target os for inplace upgrade. + :vartype inplace_upgrade_os_pair: ~azure.mgmt.testbase.models.InplaceUpgradeOSInfo + :ivar last_modified_time: The UTC timestamp when the package was last modified. + :vartype last_modified_time: ~datetime.datetime + :ivar flighting_ring: The flighting ring for feature update. + :vartype flighting_ring: str + :ivar first_party_apps: The list of first party applications to test along with user + application. + :vartype first_party_apps: list[~azure.mgmt.testbase.models.FirstPartyAppDefinition] + :ivar gallery_apps: The list of gallery apps to test along with user application. + :vartype gallery_apps: list[~azure.mgmt.testbase.models.GalleryAppDefinition] :ivar tests: The detailed test information. :vartype tests: list[~azure.mgmt.testbase.models.Test] + :ivar intune_enrollment_metadata: The metadata of Intune enrollment. + :vartype intune_enrollment_metadata: ~azure.mgmt.testbase.models.IntuneEnrollmentMetadata """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, "system_data": {"readonly": True}, + "location": {"required": True}, "provisioning_state": {"readonly": True}, - "test_types": {"readonly": True}, "package_status": {"readonly": True}, - "last_modified_time": {"readonly": True}, "is_enabled": {"readonly": True}, "validation_results": {"readonly": True}, + "test_types": {"readonly": True}, + "last_modified_time": {"readonly": True}, + "gallery_apps": {"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}"}, "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "application_name": {"key": "properties.applicationName", "type": "str"}, "version": {"key": "properties.version", "type": "str"}, - "test_types": {"key": "properties.testTypes", "type": "[str]"}, - "target_os_list": {"key": "properties.targetOSList", "type": "[TargetOSInfo]"}, + "draft_package_id": {"key": "properties.draftPackageId", "type": "str"}, "package_status": {"key": "properties.packageStatus", "type": "str"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "flighting_ring": {"key": "properties.flightingRing", "type": "str"}, "is_enabled": {"key": "properties.isEnabled", "type": "bool"}, "blob_path": {"key": "properties.blobPath", "type": "str"}, "validation_results": {"key": "properties.validationResults", "type": "[PackageValidationResult]"}, + "test_types": {"key": "properties.testTypes", "type": "[str]"}, + "target_os_list": {"key": "properties.targetOSList", "type": "[TargetOSInfo]"}, + "inplace_upgrade_os_pair": {"key": "properties.inplaceUpgradeOSPair", "type": "InplaceUpgradeOSInfo"}, + "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, + "flighting_ring": {"key": "properties.flightingRing", "type": "str"}, + "first_party_apps": {"key": "properties.firstPartyApps", "type": "[FirstPartyAppDefinition]"}, + "gallery_apps": {"key": "properties.galleryApps", "type": "[GalleryAppDefinition]"}, "tests": {"key": "properties.tests", "type": "[Test]"}, + "intune_enrollment_metadata": { + "key": "properties.intuneEnrollmentMetadata", + "type": "IntuneEnrollmentMetadata", + }, } def __init__( @@ -2484,14 +5307,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, application_name: Optional[str] = None, version: Optional[str] = None, + draft_package_id: Optional[str] = None, + blob_path: Optional[str] = None, target_os_list: Optional[List["_models.TargetOSInfo"]] = None, + inplace_upgrade_os_pair: Optional["_models.InplaceUpgradeOSInfo"] = None, flighting_ring: Optional[str] = None, - blob_path: Optional[str] = None, + first_party_apps: Optional[List["_models.FirstPartyAppDefinition"]] = None, tests: Optional[List["_models.Test"]] = None, - **kwargs - ): + intune_enrollment_metadata: Optional["_models.IntuneEnrollmentMetadata"] = None, + **kwargs: Any + ) -> None: """ - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str @@ -2499,86 +5326,101 @@ def __init__( :paramtype application_name: str :keyword version: Application version. :paramtype version: str + :keyword draft_package_id: The id of draft package. Used to create or update this package from + a draft package. + :paramtype draft_package_id: str + :keyword blob_path: The file path of the package. + :paramtype blob_path: str :keyword target_os_list: Specifies the target OSs of specific OS Update types. :paramtype target_os_list: list[~azure.mgmt.testbase.models.TargetOSInfo] + :keyword inplace_upgrade_os_pair: Specifies the baseline os and target os for inplace upgrade. + :paramtype inplace_upgrade_os_pair: ~azure.mgmt.testbase.models.InplaceUpgradeOSInfo :keyword flighting_ring: The flighting ring for feature update. :paramtype flighting_ring: str - :keyword blob_path: The file path of the package. - :paramtype blob_path: str + :keyword first_party_apps: The list of first party applications to test along with user + application. + :paramtype first_party_apps: list[~azure.mgmt.testbase.models.FirstPartyAppDefinition] :keyword tests: The detailed test information. :paramtype tests: list[~azure.mgmt.testbase.models.Test] + :keyword intune_enrollment_metadata: The metadata of Intune enrollment. + :paramtype intune_enrollment_metadata: ~azure.mgmt.testbase.models.IntuneEnrollmentMetadata """ super().__init__(tags=tags, location=location, **kwargs) - self.system_data = None self.provisioning_state = None self.application_name = application_name self.version = version - self.test_types = None - self.target_os_list = target_os_list + self.draft_package_id = draft_package_id self.package_status = None - self.last_modified_time = None - self.flighting_ring = flighting_ring self.is_enabled = None self.blob_path = blob_path self.validation_results = None + self.test_types = None + self.target_os_list = target_os_list + self.inplace_upgrade_os_pair = inplace_upgrade_os_pair + self.last_modified_time = None + self.flighting_ring = flighting_ring + self.first_party_apps = first_party_apps + self.gallery_apps = None self.tests = tests + self.intune_enrollment_metadata = intune_enrollment_metadata class PackageRunTestParameters(_serialization.Model): """The parameters supplied to the Test Base Package to start a Test Run. - All required parameters must be populated in order to send to Azure. - - :ivar test_type: The type of the test. Required. Known values are: "OutOfBoxTest" and - "FunctionalTest". + :ivar test_type: The type of the test. Known values are: "OutOfBoxTest", "FunctionalTest", and + "FlowDrivenTest". :vartype test_type: str or ~azure.mgmt.testbase.models.TestType :ivar os_update_type: Specifies the OS update type to test against. Known values are: - "SecurityUpdate" and "FeatureUpdate". + "SecurityUpdate", "FeatureUpdate", and "InplaceUpgrade". :vartype os_update_type: str or ~azure.mgmt.testbase.models.OsUpdateType - :ivar os_name: The operating system name. e.g. Windows 10 1809. Required. + :ivar os_name: The operating system name. e.g. Windows 10 1809. :vartype os_name: str :ivar release_name: The name of the tested release (OS update). :vartype release_name: str :ivar flighting_ring: The flighting ring, only for release of feature updates. :vartype flighting_ring: str + :ivar custom_image_id: The tested custom image id. 'osName', 'release', 'buildVersion' and + 'mediaPackageVersion' would be ignored when it's eligible.'. + :vartype custom_image_id: str """ - _validation = { - "test_type": {"required": True}, - "os_name": {"required": True}, - } - _attribute_map = { "test_type": {"key": "testType", "type": "str"}, "os_update_type": {"key": "osUpdateType", "type": "str"}, "os_name": {"key": "osName", "type": "str"}, "release_name": {"key": "releaseName", "type": "str"}, "flighting_ring": {"key": "flightingRing", "type": "str"}, + "custom_image_id": {"key": "customImageId", "type": "str"}, } def __init__( self, *, - test_type: Union[str, "_models.TestType"], - os_name: str, + test_type: Optional[Union[str, "_models.TestType"]] = None, os_update_type: Optional[Union[str, "_models.OsUpdateType"]] = None, + os_name: Optional[str] = None, release_name: Optional[str] = None, flighting_ring: Optional[str] = None, - **kwargs - ): + custom_image_id: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword test_type: The type of the test. Required. Known values are: "OutOfBoxTest" and - "FunctionalTest". + :keyword test_type: The type of the test. Known values are: "OutOfBoxTest", "FunctionalTest", + and "FlowDrivenTest". :paramtype test_type: str or ~azure.mgmt.testbase.models.TestType :keyword os_update_type: Specifies the OS update type to test against. Known values are: - "SecurityUpdate" and "FeatureUpdate". + "SecurityUpdate", "FeatureUpdate", and "InplaceUpgrade". :paramtype os_update_type: str or ~azure.mgmt.testbase.models.OsUpdateType - :keyword os_name: The operating system name. e.g. Windows 10 1809. Required. + :keyword os_name: The operating system name. e.g. Windows 10 1809. :paramtype os_name: str :keyword release_name: The name of the tested release (OS update). :paramtype release_name: str :keyword flighting_ring: The flighting ring, only for release of feature updates. :paramtype flighting_ring: str + :keyword custom_image_id: The tested custom image id. 'osName', 'release', 'buildVersion' and + 'mediaPackageVersion' would be ignored when it's eligible.'. + :paramtype custom_image_id: str """ super().__init__(**kwargs) self.test_type = test_type @@ -2586,6 +5428,7 @@ def __init__( self.os_name = os_name self.release_name = release_name self.flighting_ring = flighting_ring + self.custom_image_id = custom_image_id class PackageUpdateParameters(_serialization.Model): @@ -2593,61 +5436,96 @@ class PackageUpdateParameters(_serialization.Model): :ivar tags: The tags of the Package. :vartype tags: dict[str, str] - :ivar target_os_list: Specifies the target OSs of specific OS Update types. - :vartype target_os_list: list[~azure.mgmt.testbase.models.TargetOSInfo] - :ivar flighting_ring: The flighting ring for feature update. - :vartype flighting_ring: str + :ivar draft_package_id: The id of draft package. Used to create or update this package from a + draft package. + :vartype draft_package_id: str :ivar is_enabled: Specifies whether the package is enabled. It doesn't schedule test for package which is not enabled. :vartype is_enabled: bool :ivar blob_path: The file name of the package. :vartype blob_path: str + :ivar target_os_list: Specifies the target OSs of specific OS Update types. + :vartype target_os_list: list[~azure.mgmt.testbase.models.TargetOSInfo] + :ivar inplace_upgrade_os_pair: Specifies the baseline os and target os for in-place upgrade. + :vartype inplace_upgrade_os_pair: ~azure.mgmt.testbase.models.InplaceUpgradeOSInfo + :ivar flighting_ring: The flighting ring for feature update. + :vartype flighting_ring: str + :ivar first_party_apps: Specifies the list of first party applications to test along with user + application. + :vartype first_party_apps: list[~azure.mgmt.testbase.models.FirstPartyAppDefinition] :ivar tests: The detailed test information. :vartype tests: list[~azure.mgmt.testbase.models.Test] + :ivar intune_enrollment_metadata: The metadata of Intune enrollment. + :vartype intune_enrollment_metadata: ~azure.mgmt.testbase.models.IntuneEnrollmentMetadata """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, - "target_os_list": {"key": "properties.targetOSList", "type": "[TargetOSInfo]"}, - "flighting_ring": {"key": "properties.flightingRing", "type": "str"}, + "draft_package_id": {"key": "properties.draftPackageId", "type": "str"}, "is_enabled": {"key": "properties.isEnabled", "type": "bool"}, "blob_path": {"key": "properties.blobPath", "type": "str"}, + "target_os_list": {"key": "properties.targetOSList", "type": "[TargetOSInfo]"}, + "inplace_upgrade_os_pair": {"key": "properties.inplaceUpgradeOSPair", "type": "InplaceUpgradeOSInfo"}, + "flighting_ring": {"key": "properties.flightingRing", "type": "str"}, + "first_party_apps": {"key": "properties.firstPartyApps", "type": "[FirstPartyAppDefinition]"}, "tests": {"key": "properties.tests", "type": "[Test]"}, + "intune_enrollment_metadata": { + "key": "properties.intuneEnrollmentMetadata", + "type": "IntuneEnrollmentMetadata", + }, } def __init__( self, *, tags: Optional[Dict[str, str]] = None, - target_os_list: Optional[List["_models.TargetOSInfo"]] = None, - flighting_ring: Optional[str] = None, + draft_package_id: Optional[str] = None, is_enabled: Optional[bool] = None, blob_path: Optional[str] = None, + target_os_list: Optional[List["_models.TargetOSInfo"]] = None, + inplace_upgrade_os_pair: Optional["_models.InplaceUpgradeOSInfo"] = None, + flighting_ring: Optional[str] = None, + first_party_apps: Optional[List["_models.FirstPartyAppDefinition"]] = None, tests: Optional[List["_models.Test"]] = None, - **kwargs - ): + intune_enrollment_metadata: Optional["_models.IntuneEnrollmentMetadata"] = None, + **kwargs: Any + ) -> None: """ :keyword tags: The tags of the Package. :paramtype tags: dict[str, str] - :keyword target_os_list: Specifies the target OSs of specific OS Update types. - :paramtype target_os_list: list[~azure.mgmt.testbase.models.TargetOSInfo] - :keyword flighting_ring: The flighting ring for feature update. - :paramtype flighting_ring: str + :keyword draft_package_id: The id of draft package. Used to create or update this package from + a draft package. + :paramtype draft_package_id: str :keyword is_enabled: Specifies whether the package is enabled. It doesn't schedule test for package which is not enabled. :paramtype is_enabled: bool :keyword blob_path: The file name of the package. :paramtype blob_path: str + :keyword target_os_list: Specifies the target OSs of specific OS Update types. + :paramtype target_os_list: list[~azure.mgmt.testbase.models.TargetOSInfo] + :keyword inplace_upgrade_os_pair: Specifies the baseline os and target os for in-place upgrade. + :paramtype inplace_upgrade_os_pair: ~azure.mgmt.testbase.models.InplaceUpgradeOSInfo + :keyword flighting_ring: The flighting ring for feature update. + :paramtype flighting_ring: str + :keyword first_party_apps: Specifies the list of first party applications to test along with + user application. + :paramtype first_party_apps: list[~azure.mgmt.testbase.models.FirstPartyAppDefinition] :keyword tests: The detailed test information. :paramtype tests: list[~azure.mgmt.testbase.models.Test] + :keyword intune_enrollment_metadata: The metadata of Intune enrollment. + :paramtype intune_enrollment_metadata: ~azure.mgmt.testbase.models.IntuneEnrollmentMetadata """ super().__init__(**kwargs) self.tags = tags - self.target_os_list = target_os_list - self.flighting_ring = flighting_ring + self.draft_package_id = draft_package_id self.is_enabled = is_enabled self.blob_path = blob_path + self.target_os_list = target_os_list + self.inplace_upgrade_os_pair = inplace_upgrade_os_pair + self.flighting_ring = flighting_ring + self.first_party_apps = first_party_apps self.tests = tests + self.intune_enrollment_metadata = intune_enrollment_metadata class PackageValidationResult(_serialization.Model): @@ -2675,7 +5553,7 @@ class PackageValidationResult(_serialization.Model): "errors": {"key": "errors", "type": "[str]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.validation_name = None @@ -2683,13 +5561,94 @@ def __init__(self, **kwargs): self.errors = None +class PreReleaseAccessRequestSpec(_serialization.Model): + """PreReleaseAccessRequestSpec. + + :ivar organization_name: + :vartype organization_name: str + :ivar email: + :vartype email: str + :ivar engagements: + :vartype engagements: list[str or ~azure.mgmt.testbase.models.Engagements] + :ivar street_address: + :vartype street_address: str + :ivar city: + :vartype city: str + :ivar state_or_province: + :vartype state_or_province: str + :ivar zip_code: + :vartype zip_code: str + :ivar country_and_region: + :vartype country_and_region: str + :ivar company_website: + :vartype company_website: str + """ + + _attribute_map = { + "organization_name": {"key": "organizationName", "type": "str"}, + "email": {"key": "email", "type": "str"}, + "engagements": {"key": "engagements", "type": "[str]"}, + "street_address": {"key": "streetAddress", "type": "str"}, + "city": {"key": "city", "type": "str"}, + "state_or_province": {"key": "stateOrProvince", "type": "str"}, + "zip_code": {"key": "zipCode", "type": "str"}, + "country_and_region": {"key": "countryAndRegion", "type": "str"}, + "company_website": {"key": "companyWebsite", "type": "str"}, + } + + def __init__( + self, + *, + organization_name: Optional[str] = None, + email: Optional[str] = None, + engagements: Optional[List[Union[str, "_models.Engagements"]]] = None, + street_address: Optional[str] = None, + city: Optional[str] = None, + state_or_province: Optional[str] = None, + zip_code: Optional[str] = None, + country_and_region: Optional[str] = None, + company_website: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword organization_name: + :paramtype organization_name: str + :keyword email: + :paramtype email: str + :keyword engagements: + :paramtype engagements: list[str or ~azure.mgmt.testbase.models.Engagements] + :keyword street_address: + :paramtype street_address: str + :keyword city: + :paramtype city: str + :keyword state_or_province: + :paramtype state_or_province: str + :keyword zip_code: + :paramtype zip_code: str + :keyword country_and_region: + :paramtype country_and_region: str + :keyword company_website: + :paramtype company_website: str + """ + super().__init__(**kwargs) + self.organization_name = organization_name + self.email = email + self.engagements = engagements + self.street_address = street_address + self.city = city + self.state_or_province = state_or_province + self.zip_code = zip_code + self.country_and_region = country_and_region + self.company_website = company_website + + class RegressionResult(_serialization.Model): """The regression result. :ivar file_name: FileName of the binary being analyzed. :vartype file_name: str - :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", "Fail", + and "Pass". :vartype grade: str or ~azure.mgmt.testbase.models.Grade :ivar details: Message that facilitates debugging a particular regression, if any was inferred. :vartype details: str @@ -2715,13 +5674,13 @@ def __init__( details: Optional[str] = None, diff: Optional[float] = None, is_regressed: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword file_name: FileName of the binary being analyzed. :paramtype file_name: str - :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", + "Fail", and "Pass". :paramtype grade: str or ~azure.mgmt.testbase.models.Grade :keyword details: Message that facilitates debugging a particular regression, if any was inferred. @@ -2753,7 +5712,7 @@ class RegressionTestDetails(_serialization.Model): "is_regressed": {"key": "isRegressed", "type": "bool"}, } - def __init__(self, *, diff: Optional[float] = None, is_regressed: Optional[bool] = None, **kwargs): + def __init__(self, *, diff: Optional[float] = None, is_regressed: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword diff: Difference between the two datasets being analyzed. :paramtype diff: float @@ -2765,6 +5724,52 @@ def __init__(self, *, diff: Optional[float] = None, is_regressed: Optional[bool] self.is_regressed = is_regressed +class ReleaseProperties(_serialization.Model): + """The properties of an operating system release. + + :ivar release_name: The name of the OS release. + :vartype release_name: str + :ivar build_number: The build number of the OS release. + :vartype build_number: str + :ivar build_revision: The build revision of the OS release. + :vartype build_revision: str + :ivar release_version_date: The release version date of the OS release. + :vartype release_version_date: ~datetime.datetime + """ + + _attribute_map = { + "release_name": {"key": "releaseName", "type": "str"}, + "build_number": {"key": "buildNumber", "type": "str"}, + "build_revision": {"key": "buildRevision", "type": "str"}, + "release_version_date": {"key": "releaseVersionDate", "type": "iso-8601"}, + } + + def __init__( + self, + *, + release_name: Optional[str] = None, + build_number: Optional[str] = None, + build_revision: Optional[str] = None, + release_version_date: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword release_name: The name of the OS release. + :paramtype release_name: str + :keyword build_number: The build number of the OS release. + :paramtype build_number: str + :keyword build_revision: The build revision of the OS release. + :paramtype build_revision: str + :keyword release_version_date: The release version date of the OS release. + :paramtype release_version_date: ~datetime.datetime + """ + super().__init__(**kwargs) + self.release_name = release_name + self.build_number = build_number + self.build_revision = build_revision + self.release_version_date = release_version_date + + class ReliabilityResult(_serialization.Model): """The Reliability Result. @@ -2777,15 +5782,15 @@ class ReliabilityResult(_serialization.Model): :ivar hang_count: Count of number of hangs. :vartype hang_count: int :ivar regression_grade: The regression grade. Known values are: "None", "NotAvailable", "Pass", - and "Fail". + "Fail", and "Pass". :vartype regression_grade: str or ~azure.mgmt.testbase.models.Grade :ivar crash_regression_grade: The statistic regression grade for crash signal. Known values - are: "None", "NotAvailable", "Pass", and "Fail". + are: "None", "NotAvailable", "Pass", "Fail", and "Pass". :vartype crash_regression_grade: str or ~azure.mgmt.testbase.models.Grade :ivar crash_regression_test_details: Details related to the crash regression analysis. :vartype crash_regression_test_details: ~azure.mgmt.testbase.models.RegressionTestDetails :ivar hang_regression_grade: The statistic regression grade for hang signal. Known values are: - "None", "NotAvailable", "Pass", and "Fail". + "None", "NotAvailable", "Pass", "Fail", and "Pass". :vartype hang_regression_grade: str or ~azure.mgmt.testbase.models.Grade :ivar hang_regression_test_details: Details related to the hang regression analysis. :vartype hang_regression_test_details: ~azure.mgmt.testbase.models.RegressionTestDetails @@ -2815,8 +5820,8 @@ def __init__( crash_regression_test_details: Optional["_models.RegressionTestDetails"] = None, hang_regression_grade: Optional[Union[str, "_models.Grade"]] = None, hang_regression_test_details: Optional["_models.RegressionTestDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword file_name: File name. :paramtype file_name: str @@ -2827,15 +5832,15 @@ def __init__( :keyword hang_count: Count of number of hangs. :paramtype hang_count: int :keyword regression_grade: The regression grade. Known values are: "None", "NotAvailable", - "Pass", and "Fail". + "Pass", "Fail", and "Pass". :paramtype regression_grade: str or ~azure.mgmt.testbase.models.Grade :keyword crash_regression_grade: The statistic regression grade for crash signal. Known values - are: "None", "NotAvailable", "Pass", and "Fail". + are: "None", "NotAvailable", "Pass", "Fail", and "Pass". :paramtype crash_regression_grade: str or ~azure.mgmt.testbase.models.Grade :keyword crash_regression_test_details: Details related to the crash regression analysis. :paramtype crash_regression_test_details: ~azure.mgmt.testbase.models.RegressionTestDetails :keyword hang_regression_grade: The statistic regression grade for hang signal. Known values - are: "None", "NotAvailable", "Pass", and "Fail". + are: "None", "NotAvailable", "Pass", "Fail", and "Pass". :paramtype hang_regression_grade: str or ~azure.mgmt.testbase.models.Grade :keyword hang_regression_test_details: Details related to the hang regression analysis. :paramtype hang_regression_test_details: ~azure.mgmt.testbase.models.RegressionTestDetails @@ -2857,8 +5862,8 @@ class ReliabilityResultSingletonResourceProperties(AnalysisResultSingletonResour All required parameters must be populated in order to send to Azure. - :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", "Fail", + and "Pass". :vartype grade: str or ~azure.mgmt.testbase.models.Grade :ivar analysis_result_type: Type of the Analysis Result. Required. Known values are: "ScriptExecution", "Reliability", "CPUUtilization", "MemoryUtilization", "CPURegression", @@ -2866,6 +5871,10 @@ class ReliabilityResultSingletonResourceProperties(AnalysisResultSingletonResour :vartype analysis_result_type: str or ~azure.mgmt.testbase.models.AnalysisResultType :ivar reliability_results: The result array data. :vartype reliability_results: list[~azure.mgmt.testbase.models.ReliabilityResult] + :ivar inplace_upgrade_baseline_reliability_results: The result array data for target os in an + in-place upgrade test. + :vartype inplace_upgrade_baseline_reliability_results: + list[~azure.mgmt.testbase.models.ReliabilityResult] """ _validation = { @@ -2876,6 +5885,10 @@ class ReliabilityResultSingletonResourceProperties(AnalysisResultSingletonResour "grade": {"key": "grade", "type": "str"}, "analysis_result_type": {"key": "analysisResultType", "type": "str"}, "reliability_results": {"key": "reliabilityResults", "type": "[ReliabilityResult]"}, + "inplace_upgrade_baseline_reliability_results": { + "key": "inplaceUpgradeBaselineReliabilityResults", + "type": "[ReliabilityResult]", + }, } def __init__( @@ -2883,18 +5896,24 @@ def __init__( *, grade: Optional[Union[str, "_models.Grade"]] = None, reliability_results: Optional[List["_models.ReliabilityResult"]] = None, - **kwargs - ): + inplace_upgrade_baseline_reliability_results: Optional[List["_models.ReliabilityResult"]] = None, + **kwargs: Any + ) -> None: """ - :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", + "Fail", and "Pass". :paramtype grade: str or ~azure.mgmt.testbase.models.Grade :keyword reliability_results: The result array data. :paramtype reliability_results: list[~azure.mgmt.testbase.models.ReliabilityResult] + :keyword inplace_upgrade_baseline_reliability_results: The result array data for target os in + an in-place upgrade test. + :paramtype inplace_upgrade_baseline_reliability_results: + list[~azure.mgmt.testbase.models.ReliabilityResult] """ super().__init__(grade=grade, **kwargs) - self.analysis_result_type = "Reliability" # type: str + self.analysis_result_type: str = "Reliability" self.reliability_results = reliability_results + self.inplace_upgrade_baseline_reliability_results = inplace_upgrade_baseline_reliability_results class ScriptExecutionResult(_serialization.Model): @@ -2936,8 +5955,8 @@ def __init__( timed_out: Optional[bool] = None, stdout_log_file_name: Optional[str] = None, stderr_log_file_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword script_name: Name of script. :paramtype script_name: str @@ -2969,8 +5988,8 @@ class ScriptExecutionResultSingletonResourceProperties(AnalysisResultSingletonRe All required parameters must be populated in order to send to Azure. - :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", "Fail", + and "Pass". :vartype grade: str or ~azure.mgmt.testbase.models.Grade :ivar analysis_result_type: Type of the Analysis Result. Required. Known values are: "ScriptExecution", "Reliability", "CPUUtilization", "MemoryUtilization", "CPURegression", @@ -2995,17 +6014,17 @@ def __init__( *, grade: Optional[Union[str, "_models.Grade"]] = None, script_execution_results: Optional[List["_models.ScriptExecutionResult"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", + "Fail", and "Pass". :paramtype grade: str or ~azure.mgmt.testbase.models.Grade :keyword script_execution_results: The result array data. :paramtype script_execution_results: list[~azure.mgmt.testbase.models.ScriptExecutionResult] """ super().__init__(grade=grade, **kwargs) - self.analysis_result_type = "ScriptExecution" # type: str + self.analysis_result_type: str = "ScriptExecution" self.script_execution_results = script_execution_results @@ -3032,8 +6051,8 @@ def __init__( subscription_id: Optional[str] = None, subscription_name: Optional[str] = None, role: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword subscription_id: The subscription id of the notification receiver. :paramtype subscription_id: str @@ -3048,6 +6067,48 @@ def __init__( self.role = role +class SystemAssignedServiceIdentity(_serialization.Model): + """Managed service identity (either system assigned, or none). + + 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. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (either system assigned, or none). Required. Known + values are: "None" and "SystemAssigned". + :vartype type: str or ~azure.mgmt.testbase.models.SystemAssignedServiceIdentityType + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: Union[str, "_models.SystemAssignedServiceIdentityType"], **kwargs: Any) -> None: + """ + :keyword type: Type of managed service identity (either system assigned, or none). Required. + Known values are: "None" and "SystemAssigned". + :paramtype type: str or ~azure.mgmt.testbase.models.SystemAssignedServiceIdentityType + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. @@ -3063,7 +6124,7 @@ class SystemData(_serialization.Model): :ivar last_modified_by_type: The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". :vartype last_modified_by_type: str or ~azure.mgmt.testbase.models.CreatedByType - :ivar last_modified_at: The type of identity that last modified the resource. + :ivar last_modified_at: The timestamp of resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime """ @@ -3085,8 +6146,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -3100,7 +6161,7 @@ def __init__( :keyword last_modified_by_type: The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.testbase.models.CreatedByType - :keyword last_modified_at: The type of identity that last modified the resource. + :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ super().__init__(**kwargs) @@ -3112,6 +6173,40 @@ def __init__( self.last_modified_at = last_modified_at +class TabState(_serialization.Model): + """Specifies current state of tabs. + + :ivar current_tab: Current tab. Known values are: "Unspecified", "BasicsTab", + "ConfigureTestTab", "EditPackageTab", "TestMatrixTab", "TagsTab", and "ReviewAndCreateTab". + :vartype current_tab: str or ~azure.mgmt.testbase.models.PackageStudioTabs + :ivar visited_tabs: visited tabs. + :vartype visited_tabs: list[str or ~azure.mgmt.testbase.models.PackageStudioTabs] + """ + + _attribute_map = { + "current_tab": {"key": "currentTab", "type": "str"}, + "visited_tabs": {"key": "visitedTabs", "type": "[str]"}, + } + + def __init__( + self, + *, + current_tab: Optional[Union[str, "_models.PackageStudioTabs"]] = None, + visited_tabs: Optional[List[Union[str, "_models.PackageStudioTabs"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword current_tab: Current tab. Known values are: "Unspecified", "BasicsTab", + "ConfigureTestTab", "EditPackageTab", "TestMatrixTab", "TagsTab", and "ReviewAndCreateTab". + :paramtype current_tab: str or ~azure.mgmt.testbase.models.PackageStudioTabs + :keyword visited_tabs: visited tabs. + :paramtype visited_tabs: list[str or ~azure.mgmt.testbase.models.PackageStudioTabs] + """ + super().__init__(**kwargs) + self.current_tab = current_tab + self.visited_tabs = visited_tabs + + class TargetOSInfo(_serialization.Model): """The information of the target OS to be tested. @@ -3120,39 +6215,58 @@ class TargetOSInfo(_serialization.Model): :ivar os_update_type: Specifies the OS update type to test against, e.g., 'Security updates' or 'Feature updates'. Required. :vartype os_update_type: str - :ivar target_o_ss: Specifies the target OSs to be tested. Required. + :ivar target_o_ss: Specifies the target OSs to be tested. :vartype target_o_ss: list[str] + :ivar insider_channel_ids: Insider Channel Ids. Only used for feature update. + :vartype insider_channel_ids: list[str] :ivar baseline_o_ss: Specifies the baseline OSs to be tested. :vartype baseline_o_ss: list[str] + :ivar target_os_image_ids: Specifies the ids of the target OSs from Custom Images to be tested. + :vartype target_os_image_ids: list[str] """ _validation = { "os_update_type": {"required": True}, - "target_o_ss": {"required": True}, } _attribute_map = { "os_update_type": {"key": "osUpdateType", "type": "str"}, "target_o_ss": {"key": "targetOSs", "type": "[str]"}, + "insider_channel_ids": {"key": "insiderChannelIds", "type": "[str]"}, "baseline_o_ss": {"key": "baselineOSs", "type": "[str]"}, + "target_os_image_ids": {"key": "targetOSImageIds", "type": "[str]"}, } def __init__( - self, *, os_update_type: str, target_o_ss: List[str], baseline_o_ss: Optional[List[str]] = None, **kwargs - ): + self, + *, + os_update_type: str, + target_o_ss: Optional[List[str]] = None, + insider_channel_ids: Optional[List[str]] = None, + baseline_o_ss: Optional[List[str]] = None, + target_os_image_ids: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """ :keyword os_update_type: Specifies the OS update type to test against, e.g., 'Security updates' or 'Feature updates'. Required. :paramtype os_update_type: str - :keyword target_o_ss: Specifies the target OSs to be tested. Required. + :keyword target_o_ss: Specifies the target OSs to be tested. :paramtype target_o_ss: list[str] + :keyword insider_channel_ids: Insider Channel Ids. Only used for feature update. + :paramtype insider_channel_ids: list[str] :keyword baseline_o_ss: Specifies the baseline OSs to be tested. :paramtype baseline_o_ss: list[str] + :keyword target_os_image_ids: Specifies the ids of the target OSs from Custom Images to be + tested. + :paramtype target_os_image_ids: list[str] """ super().__init__(**kwargs) self.os_update_type = os_update_type self.target_o_ss = target_o_ss + self.insider_channel_ids = insider_channel_ids self.baseline_o_ss = baseline_o_ss + self.target_os_image_ids = target_os_image_ids class Test(_serialization.Model): @@ -3162,8 +6276,8 @@ class Test(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar test_type: The type of the test. Required. Known values are: "OutOfBoxTest" and - "FunctionalTest". + :ivar test_type: The type of the test. Required. Known values are: "OutOfBoxTest", + "FunctionalTest", and "FlowDrivenTest". :vartype test_type: str or ~azure.mgmt.testbase.models.TestType :ivar validation_run_status: The status of the validation run of the package. Known values are: "Unknown", "Pending", "Passed", and "Failed". @@ -3197,11 +6311,11 @@ def __init__( test_type: Union[str, "_models.TestType"], commands: List["_models.Command"], is_active: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword test_type: The type of the test. Required. Known values are: "OutOfBoxTest" and - "FunctionalTest". + :keyword test_type: The type of the test. Required. Known values are: "OutOfBoxTest", + "FunctionalTest", and "FlowDrivenTest". :paramtype test_type: str or ~azure.mgmt.testbase.models.TestType :keyword is_active: Indicates if this test is active.It doesn't schedule test for not active Test. @@ -3241,8 +6355,8 @@ def __init__( blob_data: Optional[str] = None, test_analysis_status: Optional[Union[str, "_models.TestAnalysisStatus"]] = None, identified_failures: Optional[List["_models.IdentifiedFailure"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword blob_data: The data to provide more failure analysis information. :paramtype blob_data: str @@ -3263,8 +6377,8 @@ class TestAnalysisResultSingletonResourceProperties(AnalysisResultSingletonResou All required parameters must be populated in order to send to Azure. - :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", "Fail", + and "Pass". :vartype grade: str or ~azure.mgmt.testbase.models.Grade :ivar analysis_result_type: Type of the Analysis Result. Required. Known values are: "ScriptExecution", "Reliability", "CPUUtilization", "MemoryUtilization", "CPURegression", @@ -3289,17 +6403,17 @@ def __init__( *, grade: Optional[Union[str, "_models.Grade"]] = None, test_analysis_result: Optional["_models.TestAnalysisResult"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", + "Fail", and "Pass". :paramtype grade: str or ~azure.mgmt.testbase.models.Grade :keyword test_analysis_result: The result of test analysis. :paramtype test_analysis_result: ~azure.mgmt.testbase.models.TestAnalysisResult """ super().__init__(grade=grade, **kwargs) - self.analysis_result_type = "TestAnalysis" # type: str + self.analysis_result_type: str = "TestAnalysis" self.test_analysis_result = test_analysis_result @@ -3324,7 +6438,7 @@ class TestBaseAccountListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TestBaseAccountResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TestBaseAccountResource"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Test Base Accounts. :paramtype value: list[~azure.mgmt.testbase.models.TestBaseAccountResource] @@ -3341,20 +6455,23 @@ class TestBaseAccountResource(TrackedResource): All required parameters must be populated in order to send to Azure. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar tags: The tags of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.testbase.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 etag: Resource Etag. - :vartype etag: str - :ivar system_data: The system metadata relating to this resource. - :vartype system_data: ~azure.mgmt.testbase.models.SystemData + :ivar identity: The identity of the testBaseAccount. + :vartype identity: ~azure.mgmt.testbase.models.SystemAssignedServiceIdentity :ivar provisioning_state: The provisioning state of the resource. Known values are: "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", and "Updating". :vartype provisioning_state: str or ~azure.mgmt.testbase.models.ProvisioningState @@ -3368,9 +6485,8 @@ class TestBaseAccountResource(TrackedResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, "system_data": {"readonly": True}, + "location": {"required": True}, "provisioning_state": {"readonly": True}, "access_level": {"readonly": True}, } @@ -3379,10 +6495,10 @@ class TestBaseAccountResource(TrackedResource): "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"}, - "etag": {"key": "etag", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, + "identity": {"key": "identity", "type": "SystemAssignedServiceIdentity"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "sku": {"key": "properties.sku", "type": "TestBaseAccountSKU"}, "access_level": {"key": "properties.accessLevel", "type": "str"}, @@ -3393,19 +6509,22 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.SystemAssignedServiceIdentity"] = None, sku: Optional["_models.TestBaseAccountSKU"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword tags: The tags of the resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str + :keyword identity: The identity of the testBaseAccount. + :paramtype identity: ~azure.mgmt.testbase.models.SystemAssignedServiceIdentity :keyword sku: The SKU of the Test Base Account. :paramtype sku: ~azure.mgmt.testbase.models.TestBaseAccountSKU """ super().__init__(tags=tags, location=location, **kwargs) - self.system_data = None + self.identity = identity self.provisioning_state = None self.sku = sku self.access_level = None @@ -3452,8 +6571,8 @@ def __init__( tier: Union[str, "_models.Tier"], resource_type: Optional[str] = None, locations: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_type: The type of resource the SKU applies to. :paramtype resource_type: str @@ -3494,7 +6613,7 @@ class TestBaseAccountSKUCapability(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, name: str, value: str, **kwargs): + def __init__(self, *, name: str, value: str, **kwargs: Any) -> None: """ :keyword name: An invariant to describe the feature, such as 'SLA'. Required. :paramtype name: str @@ -3527,7 +6646,7 @@ class TestBaseAccountSKUListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TestBaseAccountSKU"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TestBaseAccountSKU"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Test Base Account SKUs. :paramtype value: list[~azure.mgmt.testbase.models.TestBaseAccountSKU] @@ -3540,6 +6659,8 @@ def __init__(self, *, value: Optional[List["_models.TestBaseAccountSKU"]] = None class TestBaseAccountUpdateParameters(_serialization.Model): """Parameters supplied to update a Test Base Account. + :ivar identity: The identity of the testBaseAccount. + :vartype identity: ~azure.mgmt.testbase.models.SystemAssignedServiceIdentity :ivar tags: The tags of the Test Base Account. :vartype tags: dict[str, str] :ivar sku: The SKU of the Test Base Account. @@ -3547,20 +6668,29 @@ class TestBaseAccountUpdateParameters(_serialization.Model): """ _attribute_map = { + "identity": {"key": "identity", "type": "SystemAssignedServiceIdentity"}, "tags": {"key": "tags", "type": "{str}"}, "sku": {"key": "properties.sku", "type": "TestBaseAccountSKU"}, } def __init__( - self, *, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.TestBaseAccountSKU"] = None, **kwargs - ): + self, + *, + identity: Optional["_models.SystemAssignedServiceIdentity"] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.TestBaseAccountSKU"] = None, + **kwargs: Any + ) -> None: """ + :keyword identity: The identity of the testBaseAccount. + :paramtype identity: ~azure.mgmt.testbase.models.SystemAssignedServiceIdentity :keyword tags: The tags of the Test Base Account. :paramtype tags: dict[str, str] :keyword sku: The SKU of the Test Base Account. :paramtype sku: ~azure.mgmt.testbase.models.TestBaseAccountSKU """ super().__init__(**kwargs) + self.identity = identity self.tags = tags self.sku = sku @@ -3598,8 +6728,8 @@ def __init__( unit: Optional[str] = None, limit: Optional[int] = None, current_value: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Fully qualified ARM resource id. :paramtype id: str @@ -3643,7 +6773,7 @@ class TestBaseAccountUsageDataList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TestBaseAccountUsageData"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TestBaseAccountUsageData"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Test Base Account usage data. :paramtype value: list[~azure.mgmt.testbase.models.TestBaseAccountUsageData] @@ -3667,7 +6797,7 @@ class TestBaseAccountUsageName(_serialization.Model): "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: The identifier of the usage. :paramtype value: str @@ -3688,7 +6818,7 @@ class TestResultAnalysisSummary(_serialization.Model): "InProgress", "Failed", "Succeeded", "Available", and "NotAvailable". :vartype analysis_status: str or ~azure.mgmt.testbase.models.AnalysisStatus :ivar grade: The grade of the test result. Known values are: "None", "NotAvailable", "Pass", - and "Fail". + "Fail", and "Pass". :vartype grade: str or ~azure.mgmt.testbase.models.Grade """ @@ -3704,8 +6834,8 @@ def __init__( name: Optional[str] = None, analysis_status: Optional[Union[str, "_models.AnalysisStatus"]] = None, grade: Optional[Union[str, "_models.Grade"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Metric name. :paramtype name: str @@ -3713,7 +6843,7 @@ def __init__( "InProgress", "Failed", "Succeeded", "Available", and "NotAvailable". :paramtype analysis_status: str or ~azure.mgmt.testbase.models.AnalysisStatus :keyword grade: The grade of the test result. Known values are: "None", "NotAvailable", "Pass", - and "Fail". + "Fail", and "Pass". :paramtype grade: str or ~azure.mgmt.testbase.models.Grade """ super().__init__(**kwargs) @@ -3739,7 +6869,7 @@ class TestResultConsoleLogDownloadURLParameters(_serialization.Model): "log_file_name": {"key": "logFileName", "type": "str"}, } - def __init__(self, *, log_file_name: str, **kwargs): + def __init__(self, *, log_file_name: str, **kwargs: Any) -> None: """ :keyword log_file_name: The log file name corresponding to the download URL. Required. :paramtype log_file_name: str @@ -3748,6 +6878,61 @@ def __init__(self, *, log_file_name: str, **kwargs): self.log_file_name = log_file_name +class TestResultFirstPartyAppDefinition(_serialization.Model): + """Properties of the definition of first party application in test result. + + :ivar name: The media name of a first party application of a Test Base Account. + :vartype name: str + :ivar version: The media version of a first party application of a Test Base Account. + :vartype version: str + :ivar architecture: The architecture of a first party application of a Test Base Account. Known + values are: "x86", "x64", and "arm64". + :vartype architecture: str or ~azure.mgmt.testbase.models.Architecture + :ivar channel: The channel info of a first party application of a Test Base Account. + :vartype channel: str + :ivar ring: The ring info of a first party application of a Test Base Account. + :vartype ring: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "architecture": {"key": "architecture", "type": "str"}, + "channel": {"key": "channel", "type": "str"}, + "ring": {"key": "ring", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + version: Optional[str] = None, + architecture: Optional[Union[str, "_models.Architecture"]] = None, + channel: Optional[str] = None, + ring: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The media name of a first party application of a Test Base Account. + :paramtype name: str + :keyword version: The media version of a first party application of a Test Base Account. + :paramtype version: str + :keyword architecture: The architecture of a first party application of a Test Base Account. + Known values are: "x86", "x64", and "arm64". + :paramtype architecture: str or ~azure.mgmt.testbase.models.Architecture + :keyword channel: The channel info of a first party application of a Test Base Account. + :paramtype channel: str + :keyword ring: The ring info of a first party application of a Test Base Account. + :paramtype ring: str + """ + super().__init__(**kwargs) + self.name = name + self.version = version + self.architecture = architecture + self.channel = channel + self.ring = ring + + class TestResultListResult(_serialization.Model): """A list of Test Results. @@ -3769,7 +6954,7 @@ class TestResultListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TestResultResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TestResultResource"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Test Results. :paramtype value: list[~azure.mgmt.testbase.models.TestResultResource] @@ -3784,13 +6969,16 @@ class TestResultResource(ProxyResource): # pylint: disable=too-many-instance-at Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system metadata relating to this resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.testbase.models.SystemData :ivar baseline_test_result_id: Azure Id of the baseline test result. :vartype baseline_test_result_id: str @@ -3802,6 +6990,10 @@ class TestResultResource(ProxyResource): # pylint: disable=too-many-instance-at :vartype application_version: str :ivar os_name: The operating system name, e.g. Windows 10 1809. :vartype os_name: str + :ivar custom_image_id: Specify the referenced Test Base Custom Image Id if applicable. + :vartype custom_image_id: str + :ivar custom_image_display_name: The name of the custom image resource. + :vartype custom_image_display_name: str :ivar release_name: The name of the tested release (OS update). :vartype release_name: str :ivar release_version_date: The release version date of the tested release. @@ -3828,8 +7020,8 @@ class TestResultResource(ProxyResource): # pylint: disable=too-many-instance-at "DataProcessing", "TestFailure", "UpdateFailure", "TestAndUpdateFailure", "InfrastructureFailure", and "Completed". :vartype test_status: str or ~azure.mgmt.testbase.models.TestStatus - :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", "Fail", + and "Pass". :vartype grade: str or ~azure.mgmt.testbase.models.Grade :ivar kb_number: KB number. :vartype kb_number: str @@ -3841,6 +7033,14 @@ class TestResultResource(ProxyResource): # pylint: disable=too-many-instance-at :vartype package_version: str :ivar analysis_summaries: List of analysis summaries. :vartype analysis_summaries: list[~azure.mgmt.testbase.models.TestResultAnalysisSummary] + :ivar inplace_upgrade_properties: Properties for inplace upgrade test. + :vartype inplace_upgrade_properties: ~azure.mgmt.testbase.models.InplaceUpgradeProperties + :ivar test_start_time: The time when test starts. + :vartype test_start_time: ~datetime.datetime + :ivar test_end_time: The time when test ends. + :vartype test_end_time: ~datetime.datetime + :ivar first_party_apps: The list of first party applications tested along with the package. + :vartype first_party_apps: list[~azure.mgmt.testbase.models.TestResultFirstPartyAppDefinition] """ _validation = { @@ -3860,6 +7060,8 @@ class TestResultResource(ProxyResource): # pylint: disable=too-many-instance-at "application_name": {"key": "properties.applicationName", "type": "str"}, "application_version": {"key": "properties.applicationVersion", "type": "str"}, "os_name": {"key": "properties.osName", "type": "str"}, + "custom_image_id": {"key": "properties.customImageId", "type": "str"}, + "custom_image_display_name": {"key": "properties.customImageDisplayName", "type": "str"}, "release_name": {"key": "properties.releaseName", "type": "str"}, "release_version_date": {"key": "properties.releaseVersionDate", "type": "iso-8601"}, "flighting_ring": {"key": "properties.flightingRing", "type": "str"}, @@ -3877,6 +7079,13 @@ class TestResultResource(ProxyResource): # pylint: disable=too-many-instance-at "interop_media_version": {"key": "properties.interopMediaVersion", "type": "str"}, "package_version": {"key": "properties.packageVersion", "type": "str"}, "analysis_summaries": {"key": "properties.analysisSummaries", "type": "[TestResultAnalysisSummary]"}, + "inplace_upgrade_properties": { + "key": "properties.inplaceUpgradeProperties", + "type": "InplaceUpgradeProperties", + }, + "test_start_time": {"key": "properties.testStartTime", "type": "iso-8601"}, + "test_end_time": {"key": "properties.testEndTime", "type": "iso-8601"}, + "first_party_apps": {"key": "properties.firstPartyApps", "type": "[TestResultFirstPartyAppDefinition]"}, } def __init__( # pylint: disable=too-many-locals @@ -3887,6 +7096,8 @@ def __init__( # pylint: disable=too-many-locals application_name: Optional[str] = None, application_version: Optional[str] = None, os_name: Optional[str] = None, + custom_image_id: Optional[str] = None, + custom_image_display_name: Optional[str] = None, release_name: Optional[str] = None, release_version_date: Optional[datetime.datetime] = None, flighting_ring: Optional[str] = None, @@ -3904,8 +7115,12 @@ def __init__( # pylint: disable=too-many-locals interop_media_version: Optional[str] = None, package_version: Optional[str] = None, analysis_summaries: Optional[List["_models.TestResultAnalysisSummary"]] = None, - **kwargs - ): + inplace_upgrade_properties: Optional["_models.InplaceUpgradeProperties"] = None, + test_start_time: Optional[datetime.datetime] = None, + test_end_time: Optional[datetime.datetime] = None, + first_party_apps: Optional[List["_models.TestResultFirstPartyAppDefinition"]] = None, + **kwargs: Any + ) -> None: """ :keyword baseline_test_result_id: Azure Id of the baseline test result. :paramtype baseline_test_result_id: str @@ -3917,6 +7132,10 @@ def __init__( # pylint: disable=too-many-locals :paramtype application_version: str :keyword os_name: The operating system name, e.g. Windows 10 1809. :paramtype os_name: str + :keyword custom_image_id: Specify the referenced Test Base Custom Image Id if applicable. + :paramtype custom_image_id: str + :keyword custom_image_display_name: The name of the custom image resource. + :paramtype custom_image_display_name: str :keyword release_name: The name of the tested release (OS update). :paramtype release_name: str :keyword release_version_date: The release version date of the tested release. @@ -3943,8 +7162,8 @@ def __init__( # pylint: disable=too-many-locals "TestExecutionInProgress", "DataProcessing", "TestFailure", "UpdateFailure", "TestAndUpdateFailure", "InfrastructureFailure", and "Completed". :paramtype test_status: str or ~azure.mgmt.testbase.models.TestStatus - :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", + "Fail", and "Pass". :paramtype grade: str or ~azure.mgmt.testbase.models.Grade :keyword kb_number: KB number. :paramtype kb_number: str @@ -3956,14 +7175,24 @@ def __init__( # pylint: disable=too-many-locals :paramtype package_version: str :keyword analysis_summaries: List of analysis summaries. :paramtype analysis_summaries: list[~azure.mgmt.testbase.models.TestResultAnalysisSummary] + :keyword inplace_upgrade_properties: Properties for inplace upgrade test. + :paramtype inplace_upgrade_properties: ~azure.mgmt.testbase.models.InplaceUpgradeProperties + :keyword test_start_time: The time when test starts. + :paramtype test_start_time: ~datetime.datetime + :keyword test_end_time: The time when test ends. + :paramtype test_end_time: ~datetime.datetime + :keyword first_party_apps: The list of first party applications tested along with the package. + :paramtype first_party_apps: + list[~azure.mgmt.testbase.models.TestResultFirstPartyAppDefinition] """ super().__init__(**kwargs) - self.system_data = None self.baseline_test_result_id = baseline_test_result_id self.package_id = package_id self.application_name = application_name self.application_version = application_version self.os_name = os_name + self.custom_image_id = custom_image_id + self.custom_image_display_name = custom_image_display_name self.release_name = release_name self.release_version_date = release_version_date self.flighting_ring = flighting_ring @@ -3981,6 +7210,10 @@ def __init__( # pylint: disable=too-many-locals self.interop_media_version = interop_media_version self.package_version = package_version self.analysis_summaries = analysis_summaries + self.inplace_upgrade_properties = inplace_upgrade_properties + self.test_start_time = test_start_time + self.test_end_time = test_end_time + self.first_party_apps = first_party_apps class TestSummaryListResult(_serialization.Model): @@ -4004,7 +7237,7 @@ class TestSummaryListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TestSummaryResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TestSummaryResource"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of Test Summaries. :paramtype value: list[~azure.mgmt.testbase.models.TestSummaryResource] @@ -4019,13 +7252,16 @@ class TestSummaryResource(ProxyResource): # pylint: disable=too-many-instance-a Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system metadata relating to this resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.testbase.models.SystemData :ivar test_summary_id: The Id of the current Test Summary. :vartype test_summary_id: str @@ -4043,8 +7279,8 @@ class TestSummaryResource(ProxyResource): # pylint: disable=too-many-instance-a "TestExecutionInProgress", "DataProcessing", "TestFailure", "UpdateFailure", "TestAndUpdateFailure", "InfrastructureFailure", and "Completed". :vartype test_status: str or ~azure.mgmt.testbase.models.TestStatus - :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :ivar grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", "Fail", + and "Pass". :vartype grade: str or ~azure.mgmt.testbase.models.Grade :ivar test_run_time: The run time of the last test. :vartype test_run_time: str @@ -4052,6 +7288,9 @@ class TestSummaryResource(ProxyResource): # pylint: disable=too-many-instance-a :vartype feature_updates_test_summary: ~azure.mgmt.testbase.models.OSUpdatesTestSummary :ivar security_updates_test_summary: The result summary of tests triggered by security updates. :vartype security_updates_test_summary: ~azure.mgmt.testbase.models.OSUpdatesTestSummary + :ivar inplace_upgrades_test_summary: The result summary of tests triggered by in-place + upgrades. + :vartype inplace_upgrades_test_summary: ~azure.mgmt.testbase.models.OSUpdatesTestSummary :ivar package_tags: The tags of Package resource that are associated with the testSummary. :vartype package_tags: dict[str, str] """ @@ -4081,6 +7320,10 @@ class TestSummaryResource(ProxyResource): # pylint: disable=too-many-instance-a "key": "properties.securityUpdatesTestSummary", "type": "OSUpdatesTestSummary", }, + "inplace_upgrades_test_summary": { + "key": "properties.inplaceUpgradesTestSummary", + "type": "OSUpdatesTestSummary", + }, "package_tags": {"key": "properties.packageTags", "type": "{str}"}, } @@ -4097,9 +7340,10 @@ def __init__( test_run_time: Optional[str] = None, feature_updates_test_summary: Optional["_models.OSUpdatesTestSummary"] = None, security_updates_test_summary: Optional["_models.OSUpdatesTestSummary"] = None, + inplace_upgrades_test_summary: Optional["_models.OSUpdatesTestSummary"] = None, package_tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword test_summary_id: The Id of the current Test Summary. :paramtype test_summary_id: str @@ -4117,8 +7361,8 @@ def __init__( "TestExecutionInProgress", "DataProcessing", "TestFailure", "UpdateFailure", "TestAndUpdateFailure", "InfrastructureFailure", and "Completed". :paramtype test_status: str or ~azure.mgmt.testbase.models.TestStatus - :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", and - "Fail". + :keyword grade: The grade of the test. Known values are: "None", "NotAvailable", "Pass", + "Fail", and "Pass". :paramtype grade: str or ~azure.mgmt.testbase.models.Grade :keyword test_run_time: The run time of the last test. :paramtype test_run_time: str @@ -4128,11 +7372,13 @@ def __init__( :keyword security_updates_test_summary: The result summary of tests triggered by security updates. :paramtype security_updates_test_summary: ~azure.mgmt.testbase.models.OSUpdatesTestSummary + :keyword inplace_upgrades_test_summary: The result summary of tests triggered by in-place + upgrades. + :paramtype inplace_upgrades_test_summary: ~azure.mgmt.testbase.models.OSUpdatesTestSummary :keyword package_tags: The tags of Package resource that are associated with the testSummary. :paramtype package_tags: dict[str, str] """ super().__init__(**kwargs) - self.system_data = None self.test_summary_id = test_summary_id self.package_id = package_id self.application_name = application_name @@ -4143,6 +7389,7 @@ def __init__( self.test_run_time = test_run_time self.feature_updates_test_summary = feature_updates_test_summary self.security_updates_test_summary = security_updates_test_summary + self.inplace_upgrades_test_summary = inplace_upgrades_test_summary self.package_tags = package_tags @@ -4167,7 +7414,7 @@ class TestTypeListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.TestTypeResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.TestTypeResource"]] = None, **kwargs: Any) -> None: """ :keyword value: The list of test types. :paramtype value: list[~azure.mgmt.testbase.models.TestTypeResource] @@ -4182,13 +7429,16 @@ class TestTypeResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource ID. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system metadata relating to this resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.testbase.models.SystemData :ivar actual_test_type_name: The actual name of a test type of a Test Base Account. :vartype actual_test_type_name: str @@ -4209,13 +7459,12 @@ class TestTypeResource(ProxyResource): "actual_test_type_name": {"key": "properties.actualTestTypeName", "type": "str"}, } - def __init__(self, *, actual_test_type_name: Optional[str] = None, **kwargs): + def __init__(self, *, actual_test_type_name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword actual_test_type_name: The actual name of a test type of a Test Base Account. :paramtype actual_test_type_name: str """ super().__init__(**kwargs) - self.system_data = None self.actual_test_type_name = actual_test_type_name @@ -4230,7 +7479,7 @@ class UserObjectReceiverValue(_serialization.Model): "user_object_ids": {"key": "userObjectIds", "type": "[str]"}, } - def __init__(self, *, user_object_ids: Optional[List[str]] = None, **kwargs): + def __init__(self, *, user_object_ids: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword user_object_ids: user object ids. :paramtype user_object_ids: list[str] @@ -4253,7 +7502,7 @@ class UtilizationBound(_serialization.Model): "value": {"key": "value", "type": "float"}, } - def __init__(self, *, percentile: Optional[float] = None, value: Optional[float] = None, **kwargs): + def __init__(self, *, percentile: Optional[float] = None, value: Optional[float] = None, **kwargs: Any) -> None: """ :keyword percentile: The percentile of the bound. :paramtype percentile: float @@ -4279,7 +7528,9 @@ class UtilizationEntry(_serialization.Model): "value": {"key": "value", "type": "float"}, } - def __init__(self, *, timestamp: Optional[datetime.datetime] = None, value: Optional[float] = None, **kwargs): + def __init__( + self, *, timestamp: Optional[datetime.datetime] = None, value: Optional[float] = None, **kwargs: Any + ) -> None: """ :keyword timestamp: The timestamp. :paramtype timestamp: ~datetime.datetime @@ -4318,8 +7569,8 @@ def __init__( upper_bound: Optional["_models.UtilizationBound"] = None, lower_bound: Optional["_models.UtilizationBound"] = None, utilization: Optional[List["_models.UtilizationEntry"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword process: Process name, or '_total' for all processes. :paramtype process: str @@ -4335,3 +7586,205 @@ def __init__( self.upper_bound = upper_bound self.lower_bound = lower_bound self.utilization = utilization + + +class VerificationResult(_serialization.Model): + """The detailed result of a validation or rule checking. + + All required parameters must be populated in order to send to Azure. + + :ivar verification_name: The name of the verification rule. + :vartype verification_name: str + :ivar result: Indicates if the validation or rule checking is passed. Required. Known values + are: "Passed" and "Failed". + :vartype result: str or ~azure.mgmt.testbase.models.VerificationStatus + :ivar message: Message for clarification. + :vartype message: str + """ + + _validation = { + "result": {"required": True}, + } + + _attribute_map = { + "verification_name": {"key": "verificationName", "type": "str"}, + "result": {"key": "result", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__( + self, + *, + result: Union[str, "_models.VerificationStatus"], + verification_name: Optional[str] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword verification_name: The name of the verification rule. + :paramtype verification_name: str + :keyword result: Indicates if the validation or rule checking is passed. Required. Known values + are: "Passed" and "Failed". + :paramtype result: str or ~azure.mgmt.testbase.models.VerificationStatus + :keyword message: Message for clarification. + :paramtype message: str + """ + super().__init__(**kwargs) + self.verification_name = verification_name + self.result = result + self.message = message + + +class VHDListResult(_serialization.Model): + """A list of VHD resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of Test Base VHDs. + :vartype value: list[~azure.mgmt.testbase.models.VHDResource] + :ivar next_link: Link to the next set of results. Not empty if value contains incomplete list + of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[VHDResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.VHDResource"]] = None, **kwargs: Any) -> None: + """ + :keyword value: The list of Test Base VHDs. + :paramtype value: list[~azure.mgmt.testbase.models.VHDResource] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class VHDResource(ProxyResource): + """The Test Base VHD 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :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.testbase.models.SystemData + :ivar path: The relative path of the VHD file. + :vartype path: str + :ivar file_name: The VHD file name. + :vartype file_name: str + :ivar file_size: The file size in bytes of the VHD file. + :vartype file_size: int + :ivar status: The status of the VHD. Known values are: "Unknown", "Ready", "Failed", + "Verifying", and "Occupied". + :vartype status: str or ~azure.mgmt.testbase.models.VHDStatus + :ivar creation_time: The UTC timestamp when the VHD was created. + :vartype creation_time: ~datetime.datetime + :ivar provisioning_state: + :vartype provisioning_state: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "path": {"readonly": True}, + "file_name": {"readonly": True}, + "file_size": {"readonly": True}, + "status": {"readonly": True}, + "creation_time": {"readonly": True}, + "provisioning_state": {"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"}, + "path": {"key": "properties.path", "type": "str"}, + "file_name": {"key": "properties.fileName", "type": "str"}, + "file_size": {"key": "properties.fileSize", "type": "int"}, + "status": {"key": "properties.status", "type": "str"}, + "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.path = None + self.file_name = None + self.file_size = None + self.status = None + self.creation_time = None + self.provisioning_state = None + + +class WingetAppSkuProperties(GalleryAppSkuProperties): + """The detailed properties of a winget gallery application SKU. + + 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. + + :ivar provisioning_state: The provisioning state of the resource. Known values are: + "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.testbase.models.ProvisioningState + :ivar application_type: The application type of a gallery application. Required. "Winget" + :vartype application_type: str or ~azure.mgmt.testbase.models.ApplicationType + :ivar version: The version of a winget gallery application SKU. + :vartype version: str + :ivar license: The license description of a winget gallery application SKU. + :vartype license: str + :ivar license_url: The license URL of a winget gallery application SKU. + :vartype license_url: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "application_type": {"required": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "application_type": {"key": "applicationType", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "license": {"key": "license", "type": "str"}, + "license_url": {"key": "licenseUrl", "type": "str"}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + license: Optional[str] = None, + license_url: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword version: The version of a winget gallery application SKU. + :paramtype version: str + :keyword license: The license description of a winget gallery application SKU. + :paramtype license: str + :keyword license_url: The license URL of a winget gallery application SKU. + :paramtype license_url: str + """ + super().__init__(**kwargs) + self.application_type: str = "Winget" + self.version = version + self.license = license + self.license_url = license_url diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_test_base_enums.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_test_base_enums.py index 39ae65972fea..1d65af1edd26 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_test_base_enums.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/models/_test_base_enums.py @@ -18,6 +18,13 @@ class Action(str, Enum, metaclass=CaseInsensitiveEnumMeta): CLOSE = "Close" UNINSTALL = "Uninstall" CUSTOM = "Custom" + FLOW_DRIVEN_CUSTOM = "FlowDrivenCustom" + + +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + + INTERNAL = "Internal" class AnalysisResultName(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -56,6 +63,20 @@ class AnalysisStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): NOT_AVAILABLE = "NotAvailable" +class ApplicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of a gallery application.""" + + WINGET = "Winget" + + +class Architecture(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The architecture of an OS or a first party application.""" + + X86 = "x86" + X64 = "x64" + ARM64 = "arm64" + + class Category(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The category of the failure.""" @@ -83,6 +104,33 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" +class CredentialType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Credential type.""" + + INTUNE_ACCOUNT = "IntuneAccount" + """Username password credential for intune enrollment.""" + + +class DraftPackageSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The source type.""" + + NATIVE = "Native" + INTUNE_WIN = "IntuneWin" + TEST_BASE_PACKAGE = "TestBasePackage" + GALLERY_APP = "GalleryApp" + INTUNE_ENROLLMENT = "IntuneEnrollment" + + +class Engagements(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Engagements.""" + + MVI = "MVI" + MVP = "MVP" + SUVP = "SUVP" + MAPP = "MAPP" + OTHER = "Other" + + class ExecutionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The execution status of a test.""" @@ -96,6 +144,43 @@ class ExecutionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): SUCCEEDED = "Succeeded" +class ExtractFileType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of file to extract.""" + + TEST_BASE_PACKAGE = "TestBasePackage" + INTUNE_WIN_PACKAGE = "IntuneWinPackage" + + +class FileUploadResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource type for file uploading.""" + + PACKAGE = "Package" + """Upload file for package onboarding.""" + VHD = "VHD" + """Upload VHD file for image onboarding.""" + + +class FreeHourBalanceName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """FreeHourBalanceName.""" + + TENANT_LEVEL = "TenantLevel" + SUBSCRIPTION_LEVEL = "SubscriptionLevel" + + +class FreeHourStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """FreeHourStatus.""" + + ENABLED = "Enabled" + SUSPENDED = "Suspended" + + +class FreeHourType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """FreeHourType.""" + + PERMANENT = "Permanent" + TEMPORARY = "Temporary" + + class Grade(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The grade of a test.""" @@ -103,6 +188,98 @@ class Grade(str, Enum, metaclass=CaseInsensitiveEnumMeta): NOT_AVAILABLE = "NotAvailable" PASS = "Pass" FAIL = "Fail" + PASS_ENUM = "Pass" + + +class ImageArchitecture(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Custom image architecture.""" + + X64 = "x64" + """64-bit architecture.""" + + +class ImageOSState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Custom image OS state.""" + + GENERALIZED = "Generalized" + """Sysprep generalization processed.""" + SPECIALIZED = "Specialized" + """Fully kept with user specified settings.""" + + +class ImageSecurityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Custom image security type.""" + + STANDARD = "Standard" + """Standard security type.""" + TRUSTED_LAUNCH = "TrustedLaunch" + """Specify higher security level compared to Standard.""" + + +class ImageSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Custom image source type.""" + + UNKNOWN = "Unknown" + """Unknown image source type.""" + VHD = "VHD" + """Specify image onboarding through VHD.""" + + +class ImageStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the custom image.""" + + UNKNOWN = "Unknown" + """Unknown image status.""" + READY = "Ready" + """Completed validation and is ready for use.""" + FAILED = "Failed" + """Failed to onboard or pass validation.""" + VALIDATING = "Validating" + """Succeed to onboard but is in validation process.""" + + +class InteropExecutionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies how the first party applications should be inter-operated with user's application.""" + + FIRST_PARTY_APP_WITH_TESTS = "firstPartyAppWithTests" + """User application will test with the first party applications. For out-of-box tests, additional + #: test cases for first party applications will also be run.""" + FIRST_PARTY_APP = "firstPartyApp" + """User application will test with the first party applications.""" + + +class IntuneExtractStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Extract status.""" + + READY = "Ready" + UPLOADING = "Uploading" + UPLOAD_FAILED = "UploadFailed" + EXTRACT_FAILED = "ExtractFailed" + NO_DEPENDENCY_APP = "NoDependencyApp" + + +class OrderBy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """OrderBy.""" + + POPULARITY = "popularity" + RELEVANCE = "relevance" + + +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system". + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + + +class OsProductState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the OS product.""" + + DISABLED = "Disabled" + ACTIVE = "Active" class OsUpdateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -110,6 +287,7 @@ class OsUpdateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SECURITY_UPDATE = "SecurityUpdate" FEATURE_UPDATE = "FeatureUpdate" + INPLACE_UPGRADE = "InplaceUpgrade" class PackageStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -126,6 +304,18 @@ class PackageStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): VERIFYING_PACKAGE = "VerifyingPackage" +class PackageStudioTabs(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the tabs when creating / cloning / editing a package.""" + + UNSPECIFIED = "Unspecified" + BASICS_TAB = "BasicsTab" + CONFIGURE_TEST_TAB = "ConfigureTestTab" + EDIT_PACKAGE_TAB = "EditPackageTab" + TEST_MATRIX_TAB = "TestMatrixTab" + TAGS_TAB = "TagsTab" + REVIEW_AND_CREATE_TAB = "ReviewAndCreateTab" + + class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. @@ -146,6 +336,27 @@ class Reason(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALREADY_EXISTS = "AlreadyExists" +class RequestStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RequestStatus.""" + + IN_REVIEW = "InReview" + APPROVED = "Approved" + DECLINED = "Declined" + + +class RequestTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RequestTypes.""" + + PRE_RELEASE_ACCESS = "PreReleaseAccess" + + +class SystemAssignedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (either system assigned, or none).""" + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + + class TestAnalysisStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the analysis.""" @@ -173,6 +384,7 @@ class TestType(str, Enum, metaclass=CaseInsensitiveEnumMeta): OUT_OF_BOX_TEST = "OutOfBoxTest" FUNCTIONAL_TEST = "FunctionalTest" + FLOW_DRIVEN_TEST = "FlowDrivenTest" class Tier(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -186,6 +398,7 @@ class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): SECURITY_UPDATE = "SecurityUpdate" FEATURE_UPDATE = "FeatureUpdate" + INPLACE_UPGRADE = "InplaceUpgrade" class ValidationRunStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -195,3 +408,27 @@ class ValidationRunStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): PENDING = "Pending" PASSED = "Passed" FAILED = "Failed" + + +class VerificationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if the validation or rule checking is passed.""" + + PASSED = "Passed" + """Validation or rule checking passed.""" + FAILED = "Failed" + """Validation or rule checking failed.""" + + +class VHDStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the VHD.""" + + UNKNOWN = "Unknown" + """Unknown VHD status.""" + READY = "Ready" + """Succeed to be upload and pass VHD verification.""" + FAILED = "Failed" + """Failed to pass VHD verification.""" + VERIFYING = "Verifying" + """Processing VHD file checking and malware scanning.""" + OCCUPIED = "Occupied" + """An image is onboarding with this VHD.""" diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/__init__.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/__init__.py index cc28e4238ea1..0714ecfdeb7d 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/__init__.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/__init__.py @@ -6,11 +6,23 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._action_requests_operations import ActionRequestsOperations +from ._chat_sessions_operations import ChatSessionsOperations +from ._chat_session_operations import ChatSessionOperations +from ._custom_images_operations import CustomImagesOperations +from ._image_definitions_operations import ImageDefinitionsOperations +from ._vhds_operations import VHDsOperations +from ._draft_packages_operations import DraftPackagesOperations +from ._free_hour_balances_operations import FreeHourBalancesOperations from ._skus_operations import SkusOperations from ._test_base_accounts_operations import TestBaseAccountsOperations from ._usage_operations import UsageOperations from ._available_os_operations import AvailableOSOperations +from ._feature_update_supported_oses_operations import FeatureUpdateSupportedOsesOperations from ._flighting_rings_operations import FlightingRingsOperations +from ._first_party_apps_operations import FirstPartyAppsOperations +from ._gallery_apps_operations import GalleryAppsOperations +from ._gallery_app_skus_operations import GalleryAppSkusOperations from ._test_types_operations import TestTypesOperations from ._packages_operations import PackagesOperations from ._test_summaries_operations import TestSummariesOperations @@ -22,17 +34,32 @@ from ._customer_events_operations import CustomerEventsOperations from ._operations import Operations from ._billing_hub_service_operations import BillingHubServiceOperations +from ._available_inplace_upgrade_os_operations import AvailableInplaceUpgradeOSOperations +from ._credential_operations import CredentialOperations +from ._credentials_operations import CredentialsOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "ActionRequestsOperations", + "ChatSessionsOperations", + "ChatSessionOperations", + "CustomImagesOperations", + "ImageDefinitionsOperations", + "VHDsOperations", + "DraftPackagesOperations", + "FreeHourBalancesOperations", "SkusOperations", "TestBaseAccountsOperations", "UsageOperations", "AvailableOSOperations", + "FeatureUpdateSupportedOsesOperations", "FlightingRingsOperations", + "FirstPartyAppsOperations", + "GalleryAppsOperations", + "GalleryAppSkusOperations", "TestTypesOperations", "PackagesOperations", "TestSummariesOperations", @@ -44,6 +71,9 @@ "CustomerEventsOperations", "Operations", "BillingHubServiceOperations", + "AvailableInplaceUpgradeOSOperations", + "CredentialOperations", + "CredentialsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_action_requests_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_action_requests_operations.py new file mode 100644 index 000000000000..43bb0da1e4cc --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_action_requests_operations.py @@ -0,0 +1,635 @@ +# pylint: disable=too-many-lines +# 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, test_base_account_name: str, action_request_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/actionRequests/{actionRequestName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "actionRequestName": _SERIALIZER.url( + "action_request_name", + action_request_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_put_request( + resource_group_name: str, test_base_account_name: str, action_request_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-11-01-preview")) + 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.TestBase/testBaseAccounts/{testBaseAccountName}/actionRequests/{actionRequestName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "actionRequestName": _SERIALIZER.url( + "action_request_name", + action_request_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, test_base_account_name: str, action_request_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/actionRequests/{actionRequestName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "actionRequestName": _SERIALIZER.url( + "action_request_name", + action_request_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, + test_base_account_name: str, + subscription_id: str, + *, + request_type: Optional[str] = None, + top: Optional[int] = 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", "2023-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/actionRequests", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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") + if request_type is not None: + _params["requestType"] = _SERIALIZER.query("request_type", request_type, "str") + if top is not None: + _params["top"] = _SERIALIZER.query("top", top, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ActionRequestsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.TestBase`'s + :attr:`action_requests` 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, test_base_account_name: str, action_request_name: str, **kwargs: Any + ) -> _models.ActionRequest: + """Get the action request under the specified test base account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param action_request_name: Required. + :type action_request_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActionRequest or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ActionRequest + :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.ActionRequest] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + action_request_name=action_request_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) + + _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("ActionRequest", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/actionRequests/{actionRequestName}" + } + + @overload + def put( + self, + resource_group_name: str, + test_base_account_name: str, + action_request_name: str, + action_request: Optional[_models.ActionRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ActionRequest: + """Create (submit) an action request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param action_request_name: Required. + :type action_request_name: str + :param action_request: Default value is None. + :type action_request: ~azure.mgmt.testbase.models.ActionRequest + :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: ActionRequest or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ActionRequest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def put( + self, + resource_group_name: str, + test_base_account_name: str, + action_request_name: str, + action_request: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ActionRequest: + """Create (submit) an action request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param action_request_name: Required. + :type action_request_name: str + :param action_request: Default value is None. + :type action_request: IO + :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: ActionRequest or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ActionRequest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def put( + self, + resource_group_name: str, + test_base_account_name: str, + action_request_name: str, + action_request: Optional[Union[_models.ActionRequest, IO]] = None, + **kwargs: Any + ) -> _models.ActionRequest: + """Create (submit) an action request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param action_request_name: Required. + :type action_request_name: str + :param action_request: Is either a ActionRequest type or a IO type. Default value is None. + :type action_request: ~azure.mgmt.testbase.models.ActionRequest 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 + :return: ActionRequest or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ActionRequest + :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.ActionRequest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(action_request, (IOBase, bytes)): + _content = action_request + else: + if action_request is not None: + _json = self._serialize.body(action_request, "ActionRequest") + else: + _json = None + + request = build_put_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + action_request_name=action_request_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.put.metadata["url"], + 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("ActionRequest", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ActionRequest", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/actionRequests/{actionRequestName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, test_base_account_name: str, action_request_name: str, **kwargs: Any + ) -> None: + """Delete (revoke) an action request. Only requests in review can be deleted. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param action_request_name: Required. + :type action_request_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: + """ + 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, + test_base_account_name=test_base_account_name, + action_request_name=action_request_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) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/actionRequests/{actionRequestName}" + } + + @distributed_trace + def list( + self, + resource_group_name: str, + test_base_account_name: str, + request_type: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ActionRequest"]: + """List all action requests under the specified test base account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param request_type: Default value is None. + :type request_type: str + :param top: How many of the sorted items to consider including in the result set. Default value + is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ActionRequest or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.testbase.models.ActionRequest] + :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.ActionRequests] = 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_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + request_type=request_type, + top=top, + 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) + + 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("ActionRequests", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/actionRequests" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_analysis_results_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_analysis_results_operations.py index d59712edc1a3..975f5a471797 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_analysis_results_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_analysis_results_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,9 +49,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,13 +59,22 @@ def build_list_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), "testResultName": _SERIALIZER.url("test_result_name", test_result_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["analysisResultType"] = _SERIALIZER.query("analysis_result_type", analysis_result_type, "str") @@ -96,9 +98,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,14 +108,23 @@ def build_get_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), "testResultName": _SERIALIZER.url("test_result_name", test_result_name, "str"), "analysisResultName": _SERIALIZER.url("analysis_result_name", analysis_result_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -158,7 +167,7 @@ def list( """Lists the Analysis Results of a Test Result. The result collection will only contain one element as all the data will be nested in a singleton object. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -182,10 +191,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AnalysisResultListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AnalysisResultListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -211,7 +218,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -227,7 +234,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -235,14 +242,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AnalysisResultListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -255,7 +263,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/analysisResults"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/analysisResults" + } @distributed_trace def get( @@ -269,7 +279,7 @@ def get( ) -> _models.AnalysisResultSingletonResource: """Gets an Analysis Result of a Test Result by name. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -299,10 +309,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AnalysisResultSingletonResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AnalysisResultSingletonResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -317,10 +325,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -337,4 +346,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/analysisResults/{analysisResultName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/analysisResults/{analysisResultName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_available_inplace_upgrade_os_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_available_inplace_upgrade_os_operations.py new file mode 100644 index 000000000000..891cefdfb774 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_available_inplace_upgrade_os_operations.py @@ -0,0 +1,323 @@ +# pylint: disable=too-many-lines +# 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, Callable, Dict, Iterable, Optional, TypeVar, Union +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_list_request( + resource_group_name: str, + test_base_account_name: str, + subscription_id: str, + *, + os_update_type: Union[str, _models.OsUpdateType], + **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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableInplaceUpgradeOSs", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["osUpdateType"] = _SERIALIZER.query("os_update_type", os_update_type, "str") + _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_get_request( + resource_group_name: str, + test_base_account_name: str, + available_inplace_upgrade_os_resource_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableInplaceUpgradeOSs/{availableInplaceUpgradeOSResourceName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "availableInplaceUpgradeOSResourceName": _SERIALIZER.url( + "available_inplace_upgrade_os_resource_name", + available_inplace_upgrade_os_resource_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|(-{1,3}[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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class AvailableInplaceUpgradeOSOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.TestBase`'s + :attr:`available_inplace_upgrade_os` 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 list( + self, + resource_group_name: str, + test_base_account_name: str, + os_update_type: Union[str, _models.OsUpdateType], + **kwargs: Any + ) -> Iterable["_models.AvailableInplaceUpgradeOSResource"]: + """Lists all the available In-place Upgrade OSs to a package under a Test Base Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param os_update_type: The type of the OS Update. Known values are: "SecurityUpdate", + "FeatureUpdate", and "InplaceUpgrade". Required. + :type os_update_type: str or ~azure.mgmt.testbase.models.OsUpdateType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableInplaceUpgradeOSResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.testbase.models.AvailableInplaceUpgradeOSResource] + :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.AvailableInplaceUpgradeOSListResult] = 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_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + os_update_type=os_update_type, + 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) + + 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("AvailableInplaceUpgradeOSListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableInplaceUpgradeOSs" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + test_base_account_name: str, + available_inplace_upgrade_os_resource_name: str, + **kwargs: Any + ) -> _models.AvailableInplaceUpgradeOSResource: + """Gets an available In-place Upgrade OS to run a package under a Test Base Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param available_inplace_upgrade_os_resource_name: The resource name of an Available In-place + Upgrade OS. Required. + :type available_inplace_upgrade_os_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableInplaceUpgradeOSResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.AvailableInplaceUpgradeOSResource + :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.AvailableInplaceUpgradeOSResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + available_inplace_upgrade_os_resource_name=available_inplace_upgrade_os_resource_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) + + _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("AvailableInplaceUpgradeOSResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableInplaceUpgradeOSs/{availableInplaceUpgradeOSResourceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_available_os_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_available_os_operations.py index ab46153d5fb9..8021948b24ab 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_available_os_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_available_os_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,9 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,11 +57,18 @@ def build_list_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["osUpdateType"] = _SERIALIZER.query("os_update_type", os_update_type, "str") @@ -90,9 +90,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,12 +100,19 @@ def build_get_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), "availableOSResourceName": _SERIALIZER.url("available_os_resource_name", available_os_resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -147,13 +152,13 @@ def list( ) -> Iterable["_models.AvailableOSResource"]: """Lists all the available OSs to run a package under a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str - :param os_update_type: The type of the OS Update. Known values are: "SecurityUpdate" and - "FeatureUpdate". Required. + :param os_update_type: The type of the OS Update. Known values are: "SecurityUpdate", + "FeatureUpdate", and "InplaceUpgrade". Required. :type os_update_type: str or ~azure.mgmt.testbase.models.OsUpdateType :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOSResource or the result of cls(response) @@ -163,10 +168,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailableOSListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AvailableOSListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -190,7 +193,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -206,7 +209,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -214,14 +217,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AvailableOSListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,7 +238,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableOSs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableOSs" + } @distributed_trace def get( @@ -242,7 +248,7 @@ def get( ) -> _models.AvailableOSResource: """Gets an available OS to run a package under a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -265,10 +271,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AvailableOSResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AvailableOSResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -281,10 +285,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -301,4 +306,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableOSs/{availableOSResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableOSs/{availableOSResourceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_billing_hub_service_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_billing_hub_service_operations.py index 6dcd0366ff0c..94ab16846037 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_billing_hub_service_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_billing_hub_service_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,12 +26,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +41,7 @@ def build_get_free_hour_balance_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,11 +51,18 @@ def build_get_free_hour_balance_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,10 +79,8 @@ def build_get_usage_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,11 +90,18 @@ def build_get_usage_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -133,7 +139,7 @@ def get_free_hour_balance( ) -> _models.BillingHubGetFreeHourBalanceResponse: """get_free_hour_balance. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -154,10 +160,8 @@ def get_free_hour_balance( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingHubGetFreeHourBalanceResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BillingHubGetFreeHourBalanceResponse] = kwargs.pop("cls", None) request = build_get_free_hour_balance_request( resource_group_name=resource_group_name, @@ -169,10 +173,11 @@ def get_free_hour_balance( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -189,7 +194,9 @@ def get_free_hour_balance( return deserialized - get_free_hour_balance.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getFreeHourBalance"} # type: ignore + get_free_hour_balance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getFreeHourBalance" + } @overload def get_usage( @@ -203,7 +210,7 @@ def get_usage( ) -> _models.BillingHubGetUsageResponse: """get_usage. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -231,7 +238,7 @@ def get_usage( ) -> _models.BillingHubGetUsageResponse: """get_usage. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -257,12 +264,13 @@ def get_usage( ) -> _models.BillingHubGetUsageResponse: """get_usage. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str - :param get_usage_request: Is either a model type or a IO type. Default value is None. + :param get_usage_request: Is either a BillingHubGetUsageRequest type or a IO type. Default + value is None. :type get_usage_request: ~azure.mgmt.testbase.models.BillingHubGetUsageRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -283,16 +291,14 @@ def get_usage( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BillingHubGetUsageResponse] + 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.BillingHubGetUsageResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(get_usage_request, (IO, bytes)): + if isinstance(get_usage_request, (IOBase, bytes)): _content = get_usage_request else: if get_usage_request is not None: @@ -313,10 +319,11 @@ def get_usage( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -333,4 +340,6 @@ def get_usage( return deserialized - get_usage.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getUsage"} # type: ignore + get_usage.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getUsage" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_chat_session_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_chat_session_operations.py new file mode 100644 index 000000000000..27d3b436c977 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_chat_session_operations.py @@ -0,0 +1,346 @@ +# pylint: disable=too-many-lines +# 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, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._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_chat_request( + resource_group_name: str, test_base_account_name: str, chat_session_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-11-01-preview")) + 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.TestBase/testBaseAccounts/{testBaseAccountName}/chatSessions/{chatSessionName}/chat", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "chatSessionName": _SERIALIZER.url( + "chat_session_name", chat_session_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 ChatSessionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.TestBase`'s + :attr:`chat_session` 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") + + def _chat_initial( + self, + resource_group_name: str, + test_base_account_name: str, + chat_session_name: str, + parameters: Union[_models.ChatRequest, IO], + **kwargs: Any + ) -> Optional[_models.ChatResponse]: + 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[Optional[_models.ChatResponse]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ChatRequest") + + request = build_chat_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + chat_session_name=chat_session_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._chat_initial.metadata["url"], + 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, 202]: + 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 = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ChatResponse", pipeline_response) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _chat_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/chatSessions/{chatSessionName}/chat" + } + + @overload + def begin_chat( + self, + resource_group_name: str, + test_base_account_name: str, + chat_session_name: str, + parameters: _models.ChatRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ChatResponse]: + """Start a new chat turn. Ask a question and see the answer in response. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param chat_session_name: The chat session name. Required. + :type chat_session_name: str + :param parameters: Payload to ask a question. Required. + :type parameters: ~azure.mgmt.testbase.models.ChatRequest + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ChatResponse or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.testbase.models.ChatResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_chat( + self, + resource_group_name: str, + test_base_account_name: str, + chat_session_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ChatResponse]: + """Start a new chat turn. Ask a question and see the answer in response. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param chat_session_name: The chat session name. Required. + :type chat_session_name: str + :param parameters: Payload to ask a question. Required. + :type parameters: IO + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ChatResponse or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.testbase.models.ChatResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_chat( + self, + resource_group_name: str, + test_base_account_name: str, + chat_session_name: str, + parameters: Union[_models.ChatRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.ChatResponse]: + """Start a new chat turn. Ask a question and see the answer in response. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param chat_session_name: The chat session name. Required. + :type chat_session_name: str + :param parameters: Payload to ask a question. Is either a ChatRequest type or a IO type. + Required. + :type parameters: ~azure.mgmt.testbase.models.ChatRequest 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ChatResponse or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.testbase.models.ChatResponse] + :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.ChatResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._chat_initial( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + chat_session_name=chat_session_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ChatResponse", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_chat.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/chatSessions/{chatSessionName}/chat" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_chat_sessions_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_chat_sessions_operations.py new file mode 100644 index 000000000000..99cba804856e --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_chat_sessions_operations.py @@ -0,0 +1,295 @@ +# pylint: disable=too-many-lines +# 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, Callable, Dict, Iterable, Optional, TypeVar +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_list_request( + resource_group_name: str, test_base_account_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/chatSessions", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, test_base_account_name: str, chat_session_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/chatSessions/{chatSessionName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "chatSessionName": _SERIALIZER.url( + "chat_session_name", chat_session_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ChatSessionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.TestBase`'s + :attr:`chat_sessions` 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 list( + self, resource_group_name: str, test_base_account_name: str, **kwargs: Any + ) -> Iterable["_models.ChatSessionResource"]: + """List all chat sessions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ChatSessionResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.testbase.models.ChatSessionResource] + :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.ChatSessionResourceListResult] = 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_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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("ChatSessionResourceListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/chatSessions" + } + + @distributed_trace + def get( + self, resource_group_name: str, test_base_account_name: str, chat_session_name: str, **kwargs: Any + ) -> _models.ChatSessionResource: + """Get a chat session. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param chat_session_name: The chat session name. Required. + :type chat_session_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ChatSessionResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ChatSessionResource + :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.ChatSessionResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + chat_session_name=chat_session_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) + + _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("ChatSessionResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/chatSessions/{chatSessionName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_credential_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_credential_operations.py new file mode 100644 index 000000000000..c6f7dc6643f0 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_credential_operations.py @@ -0,0 +1,295 @@ +# pylint: disable=too-many-lines +# 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, Callable, Dict, Iterable, Optional, TypeVar +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_list_by_test_base_account_request( + resource_group_name: str, test_base_account_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, test_base_account_name: str, credential_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials/{credentialName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "credentialName": _SERIALIZER.url( + "credential_name", credential_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class CredentialOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.TestBase`'s + :attr:`credential` 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 list_by_test_base_account( + self, resource_group_name: str, test_base_account_name: str, **kwargs: Any + ) -> Iterable["_models.CredentialResource"]: + """Lists all the Credentials under a Test Base Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CredentialResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.testbase.models.CredentialResource] + :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.CredentialListResult] = 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_test_base_account_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_test_base_account.metadata["url"], + 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("CredentialListResult", 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) + + list_by_test_base_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials" + } + + @distributed_trace + def get( + self, resource_group_name: str, test_base_account_name: str, credential_name: str, **kwargs: Any + ) -> _models.CredentialResource: + """Gets a test base credential Resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param credential_name: The credential resource name. Required. + :type credential_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.CredentialResource + :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.CredentialResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + credential_name=credential_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) + + _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("CredentialResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials/{credentialName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_credentials_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_credentials_operations.py new file mode 100644 index 000000000000..b8f2935a1b99 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_credentials_operations.py @@ -0,0 +1,558 @@ +# pylint: disable=too-many-lines +# 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, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +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_create_request( + resource_group_name: str, test_base_account_name: str, credential_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-11-01-preview")) + 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.TestBase/testBaseAccounts/{testBaseAccountName}/credentials/{credentialName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "credentialName": _SERIALIZER.url( + "credential_name", credential_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, test_base_account_name: str, credential_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-11-01-preview")) + 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.TestBase/testBaseAccounts/{testBaseAccountName}/credentials/{credentialName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "credentialName": _SERIALIZER.url( + "credential_name", credential_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, test_base_account_name: str, credential_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials/{credentialName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "credentialName": _SERIALIZER.url( + "credential_name", credential_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class CredentialsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.TestBase`'s + :attr:`credentials` 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 create( + self, + resource_group_name: str, + test_base_account_name: str, + credential_name: str, + parameters: _models.CredentialResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CredentialResource: + """Creates or replaces a Test Base Credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param credential_name: The credential resource name. Required. + :type credential_name: str + :param parameters: Parameters supplied to create a Test Base Credential. Required. + :type parameters: ~azure.mgmt.testbase.models.CredentialResource + :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: CredentialResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.CredentialResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + test_base_account_name: str, + credential_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CredentialResource: + """Creates or replaces a Test Base Credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param credential_name: The credential resource name. Required. + :type credential_name: str + :param parameters: Parameters supplied to create a Test Base Credential. Required. + :type parameters: IO + :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: CredentialResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.CredentialResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + test_base_account_name: str, + credential_name: str, + parameters: Union[_models.CredentialResource, IO], + **kwargs: Any + ) -> _models.CredentialResource: + """Creates or replaces a Test Base Credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param credential_name: The credential resource name. Required. + :type credential_name: str + :param parameters: Parameters supplied to create a Test Base Credential. Is either a + CredentialResource type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.CredentialResource 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 + :return: CredentialResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.CredentialResource + :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.CredentialResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CredentialResource") + + request = build_create_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + credential_name=credential_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + _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("CredentialResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("CredentialResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials/{credentialName}" + } + + @overload + def update( + self, + resource_group_name: str, + test_base_account_name: str, + credential_name: str, + parameters: _models.CredentialResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CredentialResource: + """Updates an existing test base credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param credential_name: The credential resource name. Required. + :type credential_name: str + :param parameters: Parameters supplied to create a test base credential. Required. + :type parameters: ~azure.mgmt.testbase.models.CredentialResource + :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: CredentialResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.CredentialResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + test_base_account_name: str, + credential_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CredentialResource: + """Updates an existing test base credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param credential_name: The credential resource name. Required. + :type credential_name: str + :param parameters: Parameters supplied to create a test base credential. Required. + :type parameters: IO + :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: CredentialResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.CredentialResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + test_base_account_name: str, + credential_name: str, + parameters: Union[_models.CredentialResource, IO], + **kwargs: Any + ) -> _models.CredentialResource: + """Updates an existing test base credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param credential_name: The credential resource name. Required. + :type credential_name: str + :param parameters: Parameters supplied to create a test base credential. Is either a + CredentialResource type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.CredentialResource 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 + :return: CredentialResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.CredentialResource + :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.CredentialResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CredentialResource") + + request = build_update_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + credential_name=credential_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + _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("CredentialResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials/{credentialName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, test_base_account_name: str, credential_name: str, **kwargs: Any + ) -> None: + """Deletes an existing test base credential. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param credential_name: The credential resource name. Required. + :type credential_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: + """ + 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, + test_base_account_name=test_base_account_name, + credential_name=credential_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) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials/{credentialName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_custom_images_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_custom_images_operations.py new file mode 100644 index 000000000000..abe3ab973c5f --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_custom_images_operations.py @@ -0,0 +1,947 @@ +# pylint: disable=too-many-lines +# 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, cast, 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.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._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_list_by_test_base_account_request( + resource_group_name: str, test_base_account_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, test_base_account_name: str, custom_image_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-11-01-preview")) + 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.TestBase/testBaseAccounts/{testBaseAccountName}/customImages/{customImageName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "customImageName": _SERIALIZER.url( + "custom_image_name", custom_image_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, test_base_account_name: str, custom_image_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages/{customImageName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "customImageName": _SERIALIZER.url( + "custom_image_name", custom_image_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, test_base_account_name: str, custom_image_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages/{customImageName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "customImageName": _SERIALIZER.url( + "custom_image_name", custom_image_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_check_image_name_availability_request( + resource_group_name: str, test_base_account_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-11-01-preview")) + 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.TestBase/testBaseAccounts/{testBaseAccountName}/checkImageNameAvailability", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 CustomImagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.TestBase`'s + :attr:`custom_images` 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 list_by_test_base_account( + self, resource_group_name: str, test_base_account_name: str, **kwargs: Any + ) -> Iterable["_models.CustomImageResource"]: + """Lists all the custom images under a test base account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomImageResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.testbase.models.CustomImageResource] + :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.CustomImageListResult] = 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_test_base_account_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_test_base_account.metadata["url"], + 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("CustomImageListResult", 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) + + list_by_test_base_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages" + } + + def _create_initial( + self, + resource_group_name: str, + test_base_account_name: str, + custom_image_name: str, + parameters: Union[_models.CustomImageResource, IO], + **kwargs: Any + ) -> _models.CustomImageResource: + 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.CustomImageResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CustomImageResource") + + request = build_create_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + custom_image_name=custom_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + 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) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CustomImageResource", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("CustomImageResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages/{customImageName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + test_base_account_name: str, + custom_image_name: str, + parameters: _models.CustomImageResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomImageResource]: + """Creates a test base custom image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param custom_image_name: The resource name of the test base custom image. Required. + :type custom_image_name: str + :param parameters: Parameters supplied to create a test base custom image. Required. + :type parameters: ~azure.mgmt.testbase.models.CustomImageResource + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomImageResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.testbase.models.CustomImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + test_base_account_name: str, + custom_image_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CustomImageResource]: + """Creates a test base custom image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param custom_image_name: The resource name of the test base custom image. Required. + :type custom_image_name: str + :param parameters: Parameters supplied to create a test base custom image. Required. + :type parameters: IO + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomImageResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.testbase.models.CustomImageResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + test_base_account_name: str, + custom_image_name: str, + parameters: Union[_models.CustomImageResource, IO], + **kwargs: Any + ) -> LROPoller[_models.CustomImageResource]: + """Creates a test base custom image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param custom_image_name: The resource name of the test base custom image. Required. + :type custom_image_name: str + :param parameters: Parameters supplied to create a test base custom image. Is either a + CustomImageResource type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.CustomImageResource 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomImageResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.testbase.models.CustomImageResource] + :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.CustomImageResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + custom_image_name=custom_image_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CustomImageResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages/{customImageName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, test_base_account_name: str, custom_image_name: str, **kwargs: Any + ) -> None: + 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, + test_base_account_name=test_base_account_name, + custom_image_name=custom_image_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _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 [202, 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) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages/{customImageName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, test_base_account_name: str, custom_image_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a test base custom image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param custom_image_name: The resource name of the test base custom image. Required. + :type custom_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :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[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + custom_image_name=custom_image_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages/{customImageName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, test_base_account_name: str, custom_image_name: str, **kwargs: Any + ) -> _models.CustomImageResource: + """Gets a test base custom image. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param custom_image_name: The resource name of the test base custom image. Required. + :type custom_image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomImageResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.CustomImageResource + :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.CustomImageResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + custom_image_name=custom_image_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) + + _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("CustomImageResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages/{customImageName}" + } + + @overload + def check_image_name_availability( + self, + resource_group_name: str, + test_base_account_name: str, + parameters: _models.ImageNameCheckAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VerificationResult: + """Checks that the test vase custom image generated from VHD resource has valid and unique + definition and version, return architecture and OS state of potential existing image + definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param parameters: Parameters supplied to the test base custom image CheckAvailability + operation. Required. + :type parameters: ~azure.mgmt.testbase.models.ImageNameCheckAvailabilityParameters + :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: VerificationResult or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.VerificationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_image_name_availability( + self, + resource_group_name: str, + test_base_account_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.VerificationResult: + """Checks that the test vase custom image generated from VHD resource has valid and unique + definition and version, return architecture and OS state of potential existing image + definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param parameters: Parameters supplied to the test base custom image CheckAvailability + operation. Required. + :type parameters: IO + :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: VerificationResult or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.VerificationResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_image_name_availability( + self, + resource_group_name: str, + test_base_account_name: str, + parameters: Union[_models.ImageNameCheckAvailabilityParameters, IO], + **kwargs: Any + ) -> _models.VerificationResult: + """Checks that the test vase custom image generated from VHD resource has valid and unique + definition and version, return architecture and OS state of potential existing image + definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param parameters: Parameters supplied to the test base custom image CheckAvailability + operation. Is either a ImageNameCheckAvailabilityParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.ImageNameCheckAvailabilityParameters 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 + :return: VerificationResult or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.VerificationResult + :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.VerificationResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ImageNameCheckAvailabilityParameters") + + request = build_check_image_name_availability_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.check_image_name_availability.metadata["url"], + 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("VerificationResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_image_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/checkImageNameAvailability" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_customer_events_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_customer_events_operations.py index 5fb7ad12a666..29f7fdcef803 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_customer_events_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_customer_events_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_test_base_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,11 +55,18 @@ def build_list_by_test_base_account_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,10 +83,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,12 +94,19 @@ def build_create_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), "customerEventName": _SERIALIZER.url("customer_event_name", customer_event_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,9 +125,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,12 +135,19 @@ def build_delete_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), "customerEventName": _SERIALIZER.url("customer_event_name", customer_event_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -153,9 +164,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,12 +174,19 @@ def build_get_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), "customerEventName": _SERIALIZER.url("customer_event_name", customer_event_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -206,7 +222,7 @@ def list_by_test_base_account( ) -> Iterable["_models.CustomerEventResource"]: """Lists all notification events subscribed under a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -220,10 +236,8 @@ def list_by_test_base_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomerEventListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomerEventListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -246,7 +260,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -262,7 +276,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -270,14 +284,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("CustomerEventListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -290,7 +305,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_test_base_account.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents"} # type: ignore + list_by_test_base_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents" + } def _create_initial( self, @@ -311,16 +328,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomerEventResource] + 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.CustomerEventResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CustomerEventResource") @@ -339,10 +354,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,11 +380,13 @@ def _create_initial( deserialized = self._deserialize("CustomerEventResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}" + } @overload def begin_create( @@ -383,7 +401,7 @@ def begin_create( ) -> LROPoller[_models.CustomerEventResource]: """Create or replace a Test Base Customer Event. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -422,7 +440,7 @@ def begin_create( ) -> LROPoller[_models.CustomerEventResource]: """Create or replace a Test Base Customer Event. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -459,15 +477,15 @@ def begin_create( ) -> LROPoller[_models.CustomerEventResource]: """Create or replace a Test Base Customer Event. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str :param customer_event_name: The resource name of the Test Base Customer event. Required. :type customer_event_name: str - :param parameters: Parameters supplied to create a Test Base CustomerEvent. Is either a model - type or a IO type. Required. + :param parameters: Parameters supplied to create a Test Base CustomerEvent. Is either a + CustomerEventResource type or a IO type. Required. :type parameters: ~azure.mgmt.testbase.models.CustomerEventResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -488,16 +506,14 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomerEventResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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.CustomerEventResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, test_base_account_name=test_base_account_name, customer_event_name=customer_event_name, @@ -518,9 +534,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -532,9 +548,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, test_base_account_name: str, customer_event_name: str, **kwargs: Any @@ -550,10 +568,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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, @@ -566,10 +582,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -589,7 +606,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}" + } @distributed_trace def begin_delete( @@ -597,7 +616,7 @@ def begin_delete( ) -> LROPoller[None]: """Deletes a Test Base Customer Event. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -619,13 +638,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -644,9 +661,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -658,9 +675,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}" + } @distributed_trace def get( @@ -668,7 +687,7 @@ def get( ) -> _models.CustomerEventResource: """Gets a Test Base CustomerEvent. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -691,10 +710,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomerEventResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CustomerEventResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -707,10 +724,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -727,4 +745,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_draft_packages_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_draft_packages_operations.py new file mode 100644 index 000000000000..7718082dc04d --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_draft_packages_operations.py @@ -0,0 +1,1771 @@ +# pylint: disable=too-many-lines +# 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, cast, 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.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._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_list_by_test_base_account_request( + resource_group_name: str, + test_base_account_name: str, + subscription_id: str, + *, + package_name: Optional[str] = None, + edit_package: Optional[bool] = 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", "2023-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if package_name is not None: + _params["packageName"] = _SERIALIZER.query("package_name", package_name, "str") + if edit_package is not None: + _params["editPackage"] = _SERIALIZER.query("edit_package", edit_package, "bool") + _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_request( + resource_group_name: str, test_base_account_name: str, draft_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", "2023-11-01-preview")) + 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.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "draftPackageName": _SERIALIZER.url( + "draft_package_name", draft_package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, test_base_account_name: str, draft_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", "2023-11-01-preview")) + 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.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "draftPackageName": _SERIALIZER.url( + "draft_package_name", draft_package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, test_base_account_name: str, draft_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", "2023-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "draftPackageName": _SERIALIZER.url( + "draft_package_name", draft_package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, test_base_account_name: str, draft_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", "2023-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "draftPackageName": _SERIALIZER.url( + "draft_package_name", draft_package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_path_request( + resource_group_name: str, test_base_account_name: str, draft_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", "2023-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/getPath", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "draftPackageName": _SERIALIZER.url( + "draft_package_name", draft_package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_copy_from_package_request( + resource_group_name: str, test_base_account_name: str, draft_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", "2023-11-01-preview")) + 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.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/copyFromPackage", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "draftPackageName": _SERIALIZER.url( + "draft_package_name", draft_package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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) + + +def build_extract_file_request( + resource_group_name: str, test_base_account_name: str, draft_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", "2023-11-01-preview")) + 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.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/extractFile", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "draftPackageName": _SERIALIZER.url( + "draft_package_name", draft_package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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) + + +def build_generate_folders_and_scripts_request( + resource_group_name: str, test_base_account_name: str, draft_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", "2023-11-01-preview")) + 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.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/generateFoldersAndScripts", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "draftPackageName": _SERIALIZER.url( + "draft_package_name", draft_package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 DraftPackagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.TestBase`'s + :attr:`draft_packages` 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 list_by_test_base_account( + self, + resource_group_name: str, + test_base_account_name: str, + package_name: Optional[str] = None, + edit_package: Optional[bool] = None, + **kwargs: Any + ) -> Iterable["_models.DraftPackageResource"]: + """Lists all the draft packages under a test base account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param package_name: Parameter used to filter draft packages by linked Test Base Package. + Default value is None. + :type package_name: str + :param edit_package: Parameter used to filter draft packages by editPackage property. Default + value is None. + :type edit_package: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DraftPackageResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.testbase.models.DraftPackageResource] + :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.DraftPackageListResult] = 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_test_base_account_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + package_name=package_name, + edit_package=edit_package, + api_version=api_version, + template_url=self.list_by_test_base_account.metadata["url"], + 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("DraftPackageListResult", 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) + + list_by_test_base_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages" + } + + @overload + def create( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: _models.DraftPackageResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DraftPackageResource: + """Creates or replaces a Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to create a Test Base Draft Package. Required. + :type parameters: ~azure.mgmt.testbase.models.DraftPackageResource + :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: DraftPackageResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.DraftPackageResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DraftPackageResource: + """Creates or replaces a Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to create a Test Base Draft Package. Required. + :type parameters: IO + :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: DraftPackageResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.DraftPackageResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: Union[_models.DraftPackageResource, IO], + **kwargs: Any + ) -> _models.DraftPackageResource: + """Creates or replaces a Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to create a Test Base Draft Package. Is either a + DraftPackageResource type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.DraftPackageResource 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 + :return: DraftPackageResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.DraftPackageResource + :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.DraftPackageResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "DraftPackageResource") + + request = build_create_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + _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("DraftPackageResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DraftPackageResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}" + } + + @overload + def update( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: _models.DraftPackageUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DraftPackageResource: + """Updates an existing Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to update a Test Base Draft Package. Required. + :type parameters: ~azure.mgmt.testbase.models.DraftPackageUpdateParameters + :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: DraftPackageResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.DraftPackageResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DraftPackageResource: + """Updates an existing Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to update a Test Base Draft Package. Required. + :type parameters: IO + :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: DraftPackageResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.DraftPackageResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: Union[_models.DraftPackageUpdateParameters, IO], + **kwargs: Any + ) -> _models.DraftPackageResource: + """Updates an existing Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to update a Test Base Draft Package. Is either a + DraftPackageUpdateParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.DraftPackageUpdateParameters 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 + :return: DraftPackageResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.DraftPackageResource + :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.DraftPackageResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "DraftPackageUpdateParameters") + + request = build_update_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + _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("DraftPackageResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, test_base_account_name: str, draft_package_name: str, **kwargs: Any + ) -> None: + """Deletes a Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_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: + """ + 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, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_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) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, test_base_account_name: str, draft_package_name: str, **kwargs: Any + ) -> _models.DraftPackageResource: + """Gets a Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DraftPackageResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.DraftPackageResource + :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.DraftPackageResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_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) + + _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("DraftPackageResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}" + } + + @distributed_trace + def get_path( + self, resource_group_name: str, test_base_account_name: str, draft_package_name: str, **kwargs: Any + ) -> _models.DraftPackageGetPathResponse: + """Gets draft package path and temp working path with SAS. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DraftPackageGetPathResponse or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.DraftPackageGetPathResponse + :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.DraftPackageGetPathResponse] = kwargs.pop("cls", None) + + request = build_get_path_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_path.metadata["url"], + 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("DraftPackageGetPathResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_path.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/getPath" + } + + def _copy_from_package_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: Union[_models.CopyFromPackageOperationParameters, IO], + **kwargs: Any + ) -> None: + 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[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CopyFromPackageOperationParameters") + + request = build_copy_from_package_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._copy_from_package_initial.metadata["url"], + 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 [202]: + 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) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _copy_from_package_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/copyFromPackage" + } + + @overload + def begin_copy_from_package( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: _models.CopyFromPackageOperationParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Copy package file and metadata from a package to this draft package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package CopyFromPackage + operation. Required. + :type parameters: ~azure.mgmt.testbase.models.CopyFromPackageOperationParameters + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_copy_from_package( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Copy package file and metadata from a package to this draft package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package CopyFromPackage + operation. Required. + :type parameters: IO + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_copy_from_package( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: Union[_models.CopyFromPackageOperationParameters, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Copy package file and metadata from a package to this draft package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package CopyFromPackage + operation. Is either a CopyFromPackageOperationParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.CopyFromPackageOperationParameters 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :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[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._copy_from_package_initial( # type: ignore + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_copy_from_package.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/copyFromPackage" + } + + def _extract_file_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: Union[_models.ExtractFileOperationParameters, IO], + **kwargs: Any + ) -> None: + 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[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ExtractFileOperationParameters") + + request = build_extract_file_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._extract_file_initial.metadata["url"], + 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 [202]: + 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) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _extract_file_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/extractFile" + } + + @overload + def begin_extract_file( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: _models.ExtractFileOperationParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Performs extracting file operation for a Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package ExtractFile operation. + Required. + :type parameters: ~azure.mgmt.testbase.models.ExtractFileOperationParameters + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_extract_file( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Performs extracting file operation for a Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package ExtractFile operation. + Required. + :type parameters: IO + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_extract_file( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: Union[_models.ExtractFileOperationParameters, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Performs extracting file operation for a Test Base Draft Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package ExtractFile operation. Is + either a ExtractFileOperationParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.ExtractFileOperationParameters 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :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[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._extract_file_initial( # type: ignore + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_extract_file.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/extractFile" + } + + def _generate_folders_and_scripts_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: Union[_models.GenerateOperationParameters, IO], + **kwargs: Any + ) -> None: + 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[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "GenerateOperationParameters") + + request = build_generate_folders_and_scripts_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_folders_and_scripts_initial.metadata["url"], + 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 [202]: + 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) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _generate_folders_and_scripts_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/generateFoldersAndScripts" + } + + @overload + def begin_generate_folders_and_scripts( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: _models.GenerateOperationParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Generates folders and scripts. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package Generate operation. + Required. + :type parameters: ~azure.mgmt.testbase.models.GenerateOperationParameters + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_generate_folders_and_scripts( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Generates folders and scripts. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package Generate operation. + Required. + :type parameters: IO + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_generate_folders_and_scripts( + self, + resource_group_name: str, + test_base_account_name: str, + draft_package_name: str, + parameters: Union[_models.GenerateOperationParameters, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Generates folders and scripts. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param draft_package_name: The resource name of the Test Base Draft Package. Required. + :type draft_package_name: str + :param parameters: Parameters supplied to the Test Base Draft Package Generate operation. Is + either a GenerateOperationParameters type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.GenerateOperationParameters 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :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[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._generate_folders_and_scripts_initial( # type: ignore + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + draft_package_name=draft_package_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_folders_and_scripts.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/generateFoldersAndScripts" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_email_events_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_email_events_operations.py index 5bfec621b87f..bd8fcf35a294 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_email_events_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_email_events_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +42,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,11 +52,18 @@ def build_list_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,9 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,12 +94,19 @@ def build_get_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), "emailEventResourceName": _SERIALIZER.url("email_event_resource_name", email_event_resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +142,7 @@ def list( ) -> Iterable["_models.EmailEventResource"]: """Lists all the email events of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -150,10 +155,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmailEventListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EmailEventListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -176,7 +179,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -192,7 +195,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -200,14 +203,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("EmailEventListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -220,7 +224,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/emailEvents"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/emailEvents" + } @distributed_trace def get( @@ -228,7 +234,7 @@ def get( ) -> _models.EmailEventResource: """Gets a email event of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -251,10 +257,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.EmailEventResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EmailEventResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -267,10 +271,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -287,4 +292,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/emailEvents/{emailEventResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/emailEvents/{emailEventResourceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_favorite_processes_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_favorite_processes_operations.py index 8b818b20a71c..8508dc3fd6fb 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_favorite_processes_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_favorite_processes_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,12 +53,21 @@ def build_list_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,10 +89,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,15 +100,24 @@ def build_create_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), "favoriteProcessResourceName": _SERIALIZER.url( "favorite_process_resource_name", favorite_process_resource_name, "str" ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,9 +141,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,15 +151,24 @@ def build_delete_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), "favoriteProcessResourceName": _SERIALIZER.url( "favorite_process_resource_name", favorite_process_resource_name, "str" ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,9 +190,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -185,15 +200,24 @@ def build_get_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), "favoriteProcessResourceName": _SERIALIZER.url( "favorite_process_resource_name", favorite_process_resource_name, "str" ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,7 +253,7 @@ def list( ) -> Iterable["_models.FavoriteProcessResource"]: """Lists the favorite processes for a specific package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -245,10 +269,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FavoriteProcessListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FavoriteProcessListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -272,7 +294,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -288,7 +310,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -296,14 +318,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("FavoriteProcessListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -316,7 +339,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses" + } @overload def create( @@ -332,7 +357,7 @@ def create( ) -> _models.FavoriteProcessResource: """Create or replace a favorite process for a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -368,7 +393,7 @@ def create( ) -> _models.FavoriteProcessResource: """Create or replace a favorite process for a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -402,7 +427,7 @@ def create( ) -> _models.FavoriteProcessResource: """Create or replace a favorite process for a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -414,7 +439,7 @@ def create( 'actualProcessName' in request body to submit the name. Required. :type favorite_process_resource_name: str :param parameters: Parameters supplied to create a favorite process in a package. Is either a - model type or a IO type. Required. + FavoriteProcessResource type or a IO type. Required. :type parameters: ~azure.mgmt.testbase.models.FavoriteProcessResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -435,16 +460,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FavoriteProcessResource] + 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.FavoriteProcessResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "FavoriteProcessResource") @@ -464,10 +487,11 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -484,7 +508,9 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -497,7 +523,7 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a favorite process for a specific package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -524,10 +550,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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, @@ -541,10 +565,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -557,7 +582,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}" + } @distributed_trace def get( @@ -570,7 +597,7 @@ def get( ) -> _models.FavoriteProcessResource: """Gets a favorite process for a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -597,10 +624,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FavoriteProcessResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FavoriteProcessResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -614,10 +639,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -634,4 +660,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_feature_update_supported_oses_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_feature_update_supported_oses_operations.py new file mode 100644 index 000000000000..40f3a2cc28d7 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_feature_update_supported_oses_operations.py @@ -0,0 +1,188 @@ +# pylint: disable=too-many-lines +# 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, Callable, Dict, Iterable, Optional, TypeVar +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_list_request( + resource_group_name: str, test_base_account_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/featureUpdateSupportedOses", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class FeatureUpdateSupportedOsesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.TestBase`'s + :attr:`feature_update_supported_oses` 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 list( + self, resource_group_name: str, test_base_account_name: str, **kwargs: Any + ) -> Iterable["_models.FeatureUpdateSupportedOsesResource"]: + """Lists all the available OSs to run a package under a Test Base Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FeatureUpdateSupportedOsesResource or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.testbase.models.FeatureUpdateSupportedOsesResource] + :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.FeatureUpdateSupportedOsesResult] = 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_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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("FeatureUpdateSupportedOsesResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/featureUpdateSupportedOses" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_first_party_apps_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_first_party_apps_operations.py new file mode 100644 index 000000000000..ebcd4ed4f1d9 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_first_party_apps_operations.py @@ -0,0 +1,303 @@ +# pylint: disable=too-many-lines +# 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, Callable, Dict, Iterable, Optional, TypeVar +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_list_request( + resource_group_name: str, test_base_account_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/firstPartyApps", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + test_base_account_name: str, + first_party_app_resource_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/firstPartyApps/{firstPartyAppResourceName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "firstPartyAppResourceName": _SERIALIZER.url( + "first_party_app_resource_name", + first_party_app_resource_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9]|(-[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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class FirstPartyAppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.TestBase`'s + :attr:`first_party_apps` 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 list( + self, resource_group_name: str, test_base_account_name: str, **kwargs: Any + ) -> Iterable["_models.FirstPartyAppResource"]: + """Lists all first party applications currently available for test runs under a Test Base Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FirstPartyAppResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.testbase.models.FirstPartyAppResource] + :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.FirstPartyAppListResult] = 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_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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("FirstPartyAppListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/firstPartyApps" + } + + @distributed_trace + def get( + self, resource_group_name: str, test_base_account_name: str, first_party_app_resource_name: str, **kwargs: Any + ) -> _models.FirstPartyAppResource: + """Gets a first party application to prepare a test run for a Test Base Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param first_party_app_resource_name: The resource name of a first party application. Required. + :type first_party_app_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FirstPartyAppResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.FirstPartyAppResource + :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.FirstPartyAppResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + first_party_app_resource_name=first_party_app_resource_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) + + _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("FirstPartyAppResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/firstPartyApps/{firstPartyAppResourceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_flighting_rings_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_flighting_rings_operations.py index 61b50c63fd99..d83bfe8cf86f 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_flighting_rings_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_flighting_rings_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +42,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,11 +52,18 @@ def build_list_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,9 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,14 +94,21 @@ def build_get_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), "flightingRingResourceName": _SERIALIZER.url( "flighting_ring_resource_name", flighting_ring_resource_name, "str" ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,7 +144,7 @@ def list( ) -> Iterable["_models.FlightingRingResource"]: """Lists all the flighting rings of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -153,10 +158,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FlightingRingListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FlightingRingListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -179,7 +182,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -195,7 +198,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -203,14 +206,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("FlightingRingListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -223,7 +227,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/flightingRings"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/flightingRings" + } @distributed_trace def get( @@ -231,7 +237,7 @@ def get( ) -> _models.FlightingRingResource: """Gets a flighting ring of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -254,10 +260,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FlightingRingResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FlightingRingResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -270,10 +274,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -290,4 +295,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/flightingRings/{flightingRingResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/flightingRings/{flightingRingResourceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_free_hour_balances_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_free_hour_balances_operations.py new file mode 100644 index 000000000000..26623cc2982a --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_free_hour_balances_operations.py @@ -0,0 +1,308 @@ +# pylint: disable=too-many-lines +# 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, Callable, Dict, Iterable, Optional, TypeVar, Union +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_list_request( + resource_group_name: str, test_base_account_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/freeHourBalances", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + test_base_account_name: str, + free_hour_balance_name: Union[str, _models.FreeHourBalanceName], + 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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/freeHourBalances/{freeHourBalanceName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "freeHourBalanceName": _SERIALIZER.url("free_hour_balance_name", free_hour_balance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class FreeHourBalancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.TestBase`'s + :attr:`free_hour_balances` 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 list( + self, resource_group_name: str, test_base_account_name: str, **kwargs: Any + ) -> Iterable["_models.FreeHourBalanceResource"]: + """List all the free hour balances of a test base account. The result collection will only contain + one element as all the data will be nested in a singleton object. + + Return the Test Base free hour balances list. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FreeHourBalanceResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.testbase.models.FreeHourBalanceResource] + :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.FreeHourBalancesListResult] = 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_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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("FreeHourBalancesListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/freeHourBalances" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + test_base_account_name: str, + free_hour_balance_name: Union[str, _models.FreeHourBalanceName], + **kwargs: Any + ) -> _models.FreeHourBalanceResource: + """Get the free hour balance of a test base account. + + Return the Test Base free hour balance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param free_hour_balance_name: The name of the free hour balance of a Test Base Account. Known + values are: "TenantLevel" and "SubscriptionLevel". Required. + :type free_hour_balance_name: str or ~azure.mgmt.testbase.models.FreeHourBalanceName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FreeHourBalanceResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.FreeHourBalanceResource + :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.FreeHourBalanceResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + free_hour_balance_name=free_hour_balance_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) + + _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("FreeHourBalanceResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/freeHourBalances/{freeHourBalanceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_gallery_app_skus_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_gallery_app_skus_operations.py new file mode 100644 index 000000000000..bafde1b2cdd8 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_gallery_app_skus_operations.py @@ -0,0 +1,319 @@ +# pylint: disable=too-many-lines +# 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, Callable, Dict, Iterable, Optional, TypeVar +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_list_request( + resource_group_name: str, test_base_account_name: str, gallery_app_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/galleryApps/{galleryAppName}/galleryAppSkus", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "galleryAppName": _SERIALIZER.url( + "gallery_app_name", gallery_app_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9]|(-[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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + test_base_account_name: str, + gallery_app_name: str, + gallery_app_sku_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/galleryApps/{galleryAppName}/galleryAppSkus/{galleryAppSkuName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "galleryAppName": _SERIALIZER.url( + "gallery_app_name", gallery_app_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9]|(-[A-Za-z0-9]))+$" + ), + "galleryAppSkuName": _SERIALIZER.url( + "gallery_app_sku_name", gallery_app_sku_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9]|(-[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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class GalleryAppSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.TestBase`'s + :attr:`gallery_app_skus` 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 list( + self, resource_group_name: str, test_base_account_name: str, gallery_app_name: str, **kwargs: Any + ) -> Iterable["_models.GalleryAppSkuResource"]: + """Lists all SKUs of a gallery application currently available for test runs under a Test Base + Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param gallery_app_name: The resource name of a gallery application. Required. + :type gallery_app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryAppSkuResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.testbase.models.GalleryAppSkuResource] + :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.GalleryAppSkuListResult] = 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_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + gallery_app_name=gallery_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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("GalleryAppSkuListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/galleryApps/{galleryAppName}/galleryAppSkus" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + test_base_account_name: str, + gallery_app_name: str, + gallery_app_sku_name: str, + **kwargs: Any + ) -> _models.GalleryAppSkuResource: + """Gets a gallery application SKU to prepare a test run for a Test Base Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param gallery_app_name: The resource name of a gallery application. Required. + :type gallery_app_name: str + :param gallery_app_sku_name: The resource name of a gallery application SKU. Required. + :type gallery_app_sku_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GalleryAppSkuResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.GalleryAppSkuResource + :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.GalleryAppSkuResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + gallery_app_name=gallery_app_name, + gallery_app_sku_name=gallery_app_sku_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) + + _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("GalleryAppSkuResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/galleryApps/{galleryAppName}/galleryAppSkus/{galleryAppSkuName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_gallery_apps_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_gallery_apps_operations.py new file mode 100644 index 000000000000..b401e9c13831 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_gallery_apps_operations.py @@ -0,0 +1,333 @@ +# pylint: disable=too-many-lines +# 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, Callable, Dict, Iterable, Optional, TypeVar, Union +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_list_request( + resource_group_name: str, + test_base_account_name: str, + subscription_id: str, + *, + keyword: Optional[str] = None, + application_type: Optional[Union[str, _models.ApplicationType]] = None, + order_by: Union[str, _models.OrderBy] = "relevance", + top: Optional[int] = 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", "2023-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/galleryApps", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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") + if keyword is not None: + _params["keyword"] = _SERIALIZER.query("keyword", keyword, "str") + if application_type is not None: + _params["applicationType"] = _SERIALIZER.query("application_type", application_type, "str") + if order_by is not None: + _params["orderBy"] = _SERIALIZER.query("order_by", order_by, "str") + if top is not None: + _params["top"] = _SERIALIZER.query("top", top, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, test_base_account_name: str, gallery_app_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/galleryApps/{galleryAppName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "galleryAppName": _SERIALIZER.url( + "gallery_app_name", gallery_app_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9]|(-[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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class GalleryAppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.TestBase`'s + :attr:`gallery_apps` 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 list( + self, + resource_group_name: str, + test_base_account_name: str, + keyword: Optional[str] = None, + application_type: Optional[Union[str, _models.ApplicationType]] = None, + order_by: Union[str, _models.OrderBy] = "relevance", + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.GalleryAppResource"]: + """Lists all gallery applications currently available for test runs under a Test Base Account + which matches user query. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param keyword: The keywords which listed results should be related to. Default value is None. + :type keyword: str + :param application_type: The type of the gallery application. "Winget" Default value is None. + :type application_type: str or ~azure.mgmt.testbase.models.ApplicationType + :param order_by: The order of result list. Known values are: "popularity" and "relevance". + Default value is "relevance". + :type order_by: str or ~azure.mgmt.testbase.models.OrderBy + :param top: How many of the sorted items to consider including in the result set. Default value + is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryAppResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.testbase.models.GalleryAppResource] + :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.GalleryAppListResult] = 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_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + keyword=keyword, + application_type=application_type, + order_by=order_by, + top=top, + 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) + + 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("GalleryAppListResult", 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) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/galleryApps" + } + + @distributed_trace + def get( + self, resource_group_name: str, test_base_account_name: str, gallery_app_name: str, **kwargs: Any + ) -> _models.GalleryAppResource: + """Gets a gallery application to prepare a test run for a Test Base Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param gallery_app_name: The resource name of a gallery application. Required. + :type gallery_app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GalleryAppResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.GalleryAppResource + :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.GalleryAppResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + gallery_app_name=gallery_app_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) + + _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("GalleryAppResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/galleryApps/{galleryAppName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_image_definitions_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_image_definitions_operations.py new file mode 100644 index 000000000000..043644b14f54 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_image_definitions_operations.py @@ -0,0 +1,626 @@ +# pylint: disable=too-many-lines +# 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_list_by_test_base_account_request( + resource_group_name: str, test_base_account_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/imageDefinitions", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, + test_base_account_name: str, + image_definition_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-11-01-preview")) + 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.TestBase/testBaseAccounts/{testBaseAccountName}/imageDefinitions/{imageDefinitionName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "imageDefinitionName": _SERIALIZER.url( + "image_definition_name", + image_definition_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + test_base_account_name: str, + image_definition_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/imageDefinitions/{imageDefinitionName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "imageDefinitionName": _SERIALIZER.url( + "image_definition_name", + image_definition_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + test_base_account_name: str, + image_definition_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/imageDefinitions/{imageDefinitionName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "imageDefinitionName": _SERIALIZER.url( + "image_definition_name", + image_definition_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ImageDefinitionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.TestBase`'s + :attr:`image_definitions` 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 list_by_test_base_account( + self, resource_group_name: str, test_base_account_name: str, **kwargs: Any + ) -> Iterable["_models.ImageDefinitionResource"]: + """List all image definition properties created by test base custom images which are derived from + 'VHD' source. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ImageDefinitionResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.testbase.models.ImageDefinitionResource] + :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.ImageDefinitionsListResult] = 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_test_base_account_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_test_base_account.metadata["url"], + 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("ImageDefinitionsListResult", 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) + + list_by_test_base_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/imageDefinitions" + } + + @overload + def create( + self, + resource_group_name: str, + test_base_account_name: str, + image_definition_name: str, + parameters: _models.ImageDefinitionResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ImageDefinitionResource: + """Create image definition for test base custom images which are derived from 'VHD' source. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param image_definition_name: The resource name of the test base image definition. Required. + :type image_definition_name: str + :param parameters: Parameters supplied to create a test base image definition. Required. + :type parameters: ~azure.mgmt.testbase.models.ImageDefinitionResource + :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: ImageDefinitionResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ImageDefinitionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + test_base_account_name: str, + image_definition_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ImageDefinitionResource: + """Create image definition for test base custom images which are derived from 'VHD' source. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param image_definition_name: The resource name of the test base image definition. Required. + :type image_definition_name: str + :param parameters: Parameters supplied to create a test base image definition. Required. + :type parameters: IO + :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: ImageDefinitionResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ImageDefinitionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + test_base_account_name: str, + image_definition_name: str, + parameters: Union[_models.ImageDefinitionResource, IO], + **kwargs: Any + ) -> _models.ImageDefinitionResource: + """Create image definition for test base custom images which are derived from 'VHD' source. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param image_definition_name: The resource name of the test base image definition. Required. + :type image_definition_name: str + :param parameters: Parameters supplied to create a test base image definition. Is either a + ImageDefinitionResource type or a IO type. Required. + :type parameters: ~azure.mgmt.testbase.models.ImageDefinitionResource 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 + :return: ImageDefinitionResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ImageDefinitionResource + :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.ImageDefinitionResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ImageDefinitionResource") + + request = build_create_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + image_definition_name=image_definition_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + _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("ImageDefinitionResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("ImageDefinitionResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/imageDefinitions/{imageDefinitionName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, test_base_account_name: str, image_definition_name: str, **kwargs: Any + ) -> _models.ImageDefinitionResource: + """Get image properties under the image definition name created by test base custom image which + derived from 'VHD' source. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param image_definition_name: The resource name of the test base image definition. Required. + :type image_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ImageDefinitionResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.ImageDefinitionResource + :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.ImageDefinitionResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + image_definition_name=image_definition_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) + + _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("ImageDefinitionResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/imageDefinitions/{imageDefinitionName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, test_base_account_name: str, image_definition_name: str, **kwargs: Any + ) -> None: + """Delete a test base image definition resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param image_definition_name: The resource name of the test base image definition. Required. + :type image_definition_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: + """ + 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, + test_base_account_name=test_base_account_name, + image_definition_name=image_definition_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) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/imageDefinitions/{imageDefinitionName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_operations.py index 578a88cf24ef..25e5d3df9450 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +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 = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,10 +86,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -116,7 +107,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -132,7 +123,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -140,14 +131,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -160,4 +152,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.TestBase/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.TestBase/operations"} diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_os_updates_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_os_updates_operations.py index a6a20f8b3054..05bc246852fa 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_os_updates_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_os_updates_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,9 +48,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,12 +58,21 @@ def build_list_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["osUpdateType"] = _SERIALIZER.query("os_update_type", os_update_type, "str") @@ -93,9 +95,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,13 +105,22 @@ def build_get_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), "osUpdateResourceName": _SERIALIZER.url("os_update_resource_name", os_update_resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -152,15 +161,15 @@ def list( ) -> Iterable["_models.OSUpdateResource"]: """Lists the OS Updates in which the package were tested before. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str :param package_name: The resource name of the Test Base Package. Required. :type package_name: str - :param os_update_type: The type of the OS Update. Known values are: "SecurityUpdate" and - "FeatureUpdate". Required. + :param os_update_type: The type of the OS Update. Known values are: "SecurityUpdate", + "FeatureUpdate", and "InplaceUpgrade". Required. :type os_update_type: str or ~azure.mgmt.testbase.models.OsUpdateType :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OSUpdateResource or the result of cls(response) @@ -170,10 +179,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OSUpdateListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OSUpdateListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -198,7 +205,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -214,7 +221,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -222,14 +229,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OSUpdateListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,7 +250,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/osUpdates"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/osUpdates" + } @distributed_trace def get( @@ -255,7 +265,7 @@ def get( ) -> _models.OSUpdateResource: """Gets an OS Update by name in which the package was tested before. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -280,10 +290,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OSUpdateResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OSUpdateResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -297,10 +305,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -317,4 +326,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/osUpdates/{osUpdateResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/osUpdates/{osUpdateResourceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_packages_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_packages_operations.py index 0e2b35da0384..2d1336152144 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_packages_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_packages_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_list_by_test_base_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,11 +55,18 @@ def build_list_by_test_base_account_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,10 +83,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,12 +94,21 @@ def build_create_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,10 +127,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,12 +138,21 @@ def build_update_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -156,9 +171,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,12 +181,21 @@ def build_delete_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -190,9 +212,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,12 +222,21 @@ def build_get_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -224,9 +253,7 @@ def build_hard_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -236,12 +263,21 @@ def build_hard_delete_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -258,9 +294,7 @@ def build_get_download_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,12 +304,21 @@ def build_get_download_url_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -292,10 +335,8 @@ def build_run_test_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -305,12 +346,21 @@ def build_run_test_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -348,7 +398,7 @@ def list_by_test_base_account( ) -> Iterable["_models.PackageResource"]: """Lists all the packages under a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -361,10 +411,8 @@ def list_by_test_base_account( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PackageListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PackageListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -387,7 +435,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -403,7 +451,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -411,14 +459,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PackageListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -431,7 +480,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_test_base_account.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages"} # type: ignore + list_by_test_base_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages" + } def _create_initial( self, @@ -452,16 +503,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PackageResource] + 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.PackageResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PackageResource") @@ -480,10 +529,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,11 +555,13 @@ def _create_initial( deserialized = self._deserialize("PackageResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" + } @overload def begin_create( @@ -524,7 +576,7 @@ def begin_create( ) -> LROPoller[_models.PackageResource]: """Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -563,7 +615,7 @@ def begin_create( ) -> LROPoller[_models.PackageResource]: """Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -600,15 +652,15 @@ def begin_create( ) -> LROPoller[_models.PackageResource]: """Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str :param package_name: The resource name of the Test Base Package. Required. :type package_name: str - :param parameters: Parameters supplied to create a Test Base Package. Is either a model type or - a IO type. Required. + :param parameters: Parameters supplied to create a Test Base Package. Is either a + PackageResource type or a IO type. Required. :type parameters: ~azure.mgmt.testbase.models.PackageResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -629,16 +681,14 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PackageResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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.PackageResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, test_base_account_name=test_base_account_name, package_name=package_name, @@ -659,9 +709,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -673,9 +723,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" + } def _update_initial( self, @@ -696,16 +748,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PackageResource]] + 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[Optional[_models.PackageResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PackageUpdateParameters") @@ -724,10 +774,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -759,7 +810,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" + } @overload def begin_update( @@ -774,7 +827,7 @@ def begin_update( ) -> LROPoller[_models.PackageResource]: """Update an existing Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -813,7 +866,7 @@ def begin_update( ) -> LROPoller[_models.PackageResource]: """Update an existing Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -850,15 +903,15 @@ def begin_update( ) -> LROPoller[_models.PackageResource]: """Update an existing Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str :param package_name: The resource name of the Test Base Package. Required. :type package_name: str - :param parameters: Parameters supplied to update a Test Base Package. Is either a model type or - a IO type. Required. + :param parameters: Parameters supplied to update a Test Base Package. Is either a + PackageUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.testbase.models.PackageUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -879,16 +932,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PackageResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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.PackageResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, test_base_account_name=test_base_account_name, package_name=package_name, @@ -909,9 +960,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -923,9 +974,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, test_base_account_name: str, package_name: str, **kwargs: Any @@ -941,10 +994,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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, @@ -957,10 +1008,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -980,7 +1032,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" + } @distributed_trace def begin_delete( @@ -988,7 +1042,7 @@ def begin_delete( ) -> LROPoller[None]: """Deletes a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1010,13 +1064,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1035,9 +1087,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1049,9 +1101,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" + } @distributed_trace def get( @@ -1059,7 +1113,7 @@ def get( ) -> _models.PackageResource: """Gets a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1082,10 +1136,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PackageResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PackageResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -1098,10 +1150,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1118,7 +1171,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" + } def _hard_delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, test_base_account_name: str, package_name: str, **kwargs: Any @@ -1134,10 +1189,8 @@ def _hard_delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_hard_delete_request( resource_group_name=resource_group_name, @@ -1150,10 +1203,11 @@ def _hard_delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1173,7 +1227,9 @@ def _hard_delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _hard_delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/hardDelete"} # type: ignore + _hard_delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/hardDelete" + } @distributed_trace def begin_hard_delete( @@ -1181,7 +1237,7 @@ def begin_hard_delete( ) -> LROPoller[None]: """Hard Delete a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1203,13 +1259,11 @@ def begin_hard_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._hard_delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1228,9 +1282,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1242,9 +1296,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_hard_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/hardDelete"} # type: ignore + begin_hard_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/hardDelete" + } @distributed_trace def get_download_url( @@ -1252,7 +1308,7 @@ def get_download_url( ) -> _models.DownloadURLResponse: """Gets the download URL of a package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1275,10 +1331,8 @@ def get_download_url( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadURLResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DownloadURLResponse] = kwargs.pop("cls", None) request = build_get_download_url_request( resource_group_name=resource_group_name, @@ -1291,10 +1345,11 @@ def get_download_url( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1311,7 +1366,9 @@ def get_download_url( return deserialized - get_download_url.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/getDownloadUrl"} # type: ignore + get_download_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/getDownloadUrl" + } @overload def run_test( # pylint: disable=inconsistent-return-statements @@ -1326,7 +1383,7 @@ def run_test( # pylint: disable=inconsistent-return-statements ) -> None: """Trigger a test run on the package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1358,7 +1415,7 @@ def run_test( # pylint: disable=inconsistent-return-statements ) -> None: """Trigger a test run on the package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1388,7 +1445,7 @@ def run_test( # pylint: disable=inconsistent-return-statements ) -> None: """Trigger a test run on the package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1396,7 +1453,7 @@ def run_test( # pylint: disable=inconsistent-return-statements :param package_name: The resource name of the Test Base Package. Required. :type package_name: str :param parameters: The parameters supplied to the Test Base Package to start a Test Run. Is - either a model type or a IO type. Default value is None. + either a PackageRunTestParameters type or a IO type. Default value is None. :type parameters: ~azure.mgmt.testbase.models.PackageRunTestParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1417,16 +1474,14 @@ def run_test( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: if parameters is not None: @@ -1448,10 +1503,11 @@ def run_test( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1471,4 +1527,6 @@ def run_test( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - run_test.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/runTest"} # type: ignore + run_test.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/runTest" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_skus_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_skus_operations.py index d5e710876936..30bb6d86c42e 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_skus_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_skus_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +49,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,10 +91,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.TestBaseAccountSKU"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestBaseAccountSKUListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestBaseAccountSKUListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -122,7 +113,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -138,7 +129,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -146,14 +137,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TestBaseAccountSKUListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -166,4 +158,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.TestBase/skus"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.TestBase/skus"} diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_accounts_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_accounts_operations.py index 74e1780153fd..e1ce604465e4 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_accounts_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_base_accounts_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,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 = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +54,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if get_deleted is not None: @@ -79,9 +73,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 = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,10 +83,12 @@ def build_list_by_resource_group_request( ) # 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"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if get_deleted is not None: @@ -118,10 +112,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,11 +123,18 @@ def build_create_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if restore is not None: @@ -156,10 +155,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,11 +166,18 @@ def build_update_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -192,9 +196,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,11 +206,18 @@ def build_delete_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -225,9 +234,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -237,11 +244,18 @@ def build_get_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -258,9 +272,7 @@ def build_offboard_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,11 +282,18 @@ def build_offboard_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -291,10 +310,8 @@ def build_get_file_upload_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -304,11 +321,18 @@ def build_get_file_upload_url_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -327,10 +351,8 @@ def build_check_package_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -340,11 +362,18 @@ def build_check_package_name_availability_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -380,7 +409,7 @@ def __init__(self, *args, **kwargs): def list_by_subscription( self, get_deleted: Optional[bool] = None, **kwargs: Any ) -> Iterable["_models.TestBaseAccountResource"]: - """Lists all the Test Base Accounts in a subscription. This API is required by ARM guidelines. + """Lists all the Test Base Accounts in a subscription. :param get_deleted: The flag indicating if we need to include the Test Base Accounts which were soft deleted before. Default value is None. @@ -394,10 +423,8 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestBaseAccountListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestBaseAccountListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -419,7 +446,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -435,7 +462,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -443,14 +470,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TestBaseAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -463,7 +491,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.TestBase/testBaseAccounts"} # type: ignore + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.TestBase/testBaseAccounts" + } @distributed_trace def list_by_resource_group( @@ -471,7 +501,7 @@ def list_by_resource_group( ) -> Iterable["_models.TestBaseAccountResource"]: """Lists all the Test Base Accounts in a resource group. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param get_deleted: The flag indicating if we need to include the Test Base Accounts which were @@ -486,10 +516,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestBaseAccountListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestBaseAccountListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -512,7 +540,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -528,7 +556,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -536,14 +564,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TestBaseAccountListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -556,7 +585,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts" + } def _create_initial( self, @@ -577,16 +608,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestBaseAccountResource] + 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.TestBaseAccountResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TestBaseAccountResource") @@ -605,10 +634,11 @@ def _create_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -630,11 +660,13 @@ def _create_initial( deserialized = self._deserialize("TestBaseAccountResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" + } @overload def begin_create( @@ -650,7 +682,7 @@ def begin_create( """Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified subscription. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -691,7 +723,7 @@ def begin_create( """Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified subscription. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -730,13 +762,13 @@ def begin_create( """Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified subscription. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str - :param parameters: Parameters supplied to create a Test Base Account. Is either a model type or - a IO type. Required. + :param parameters: Parameters supplied to create a Test Base Account. Is either a + TestBaseAccountResource type or a IO type. Required. :type parameters: ~azure.mgmt.testbase.models.TestBaseAccountResource or IO :param restore: The flag indicating if we would like to restore the Test Base Accounts which were soft deleted before. Default value is None. @@ -760,16 +792,14 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestBaseAccountResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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.TestBaseAccountResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, test_base_account_name=test_base_account_name, parameters=parameters, @@ -790,9 +820,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -804,9 +834,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" + } def _update_initial( self, @@ -826,16 +858,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.TestBaseAccountResource]] + 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[Optional[_models.TestBaseAccountResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TestBaseAccountUpdateParameters") @@ -853,10 +883,11 @@ def _update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -888,7 +919,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" + } @overload def begin_update( @@ -902,7 +935,7 @@ def begin_update( ) -> LROPoller[_models.TestBaseAccountResource]: """Update an existing Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -938,7 +971,7 @@ def begin_update( ) -> LROPoller[_models.TestBaseAccountResource]: """Update an existing Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -972,13 +1005,13 @@ def begin_update( ) -> LROPoller[_models.TestBaseAccountResource]: """Update an existing Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str - :param parameters: Parameters supplied to update a Test Base Account. Is either a model type or - a IO type. Required. + :param parameters: Parameters supplied to update a Test Base Account. Is either a + TestBaseAccountUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.testbase.models.TestBaseAccountUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -999,16 +1032,14 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestBaseAccountResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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.TestBaseAccountResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, test_base_account_name=test_base_account_name, parameters=parameters, @@ -1028,9 +1059,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1042,9 +1073,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, test_base_account_name: str, **kwargs: Any @@ -1060,10 +1093,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + 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, @@ -1075,10 +1106,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1098,13 +1130,15 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" + } @distributed_trace def begin_delete(self, resource_group_name: str, test_base_account_name: str, **kwargs: Any) -> LROPoller[None]: """Deletes a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1124,13 +1158,11 @@ def begin_delete(self, resource_group_name: str, test_base_account_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1148,9 +1180,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1162,9 +1194,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" + } @distributed_trace def get( @@ -1172,7 +1206,7 @@ def get( ) -> _models.TestBaseAccountResource: """Gets a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1193,10 +1227,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestBaseAccountResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestBaseAccountResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -1208,10 +1240,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1228,7 +1261,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" + } def _offboard_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, test_base_account_name: str, **kwargs: Any @@ -1244,10 +1279,8 @@ def _offboard_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_offboard_request( resource_group_name=resource_group_name, @@ -1259,10 +1292,11 @@ def _offboard_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1282,13 +1316,15 @@ def _offboard_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _offboard_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/offboard"} # type: ignore + _offboard_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/offboard" + } @distributed_trace def begin_offboard(self, resource_group_name: str, test_base_account_name: str, **kwargs: Any) -> LROPoller[None]: """Offboard a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1308,13 +1344,11 @@ def begin_offboard(self, resource_group_name: str, test_base_account_name: str, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._offboard_initial( # type: ignore resource_group_name=resource_group_name, @@ -1332,9 +1366,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1346,9 +1380,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_offboard.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/offboard"} # type: ignore + begin_offboard.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/offboard" + } @overload def get_file_upload_url( @@ -1362,7 +1398,7 @@ def get_file_upload_url( ) -> _models.FileUploadURLResponse: """Gets the file upload URL of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1391,7 +1427,7 @@ def get_file_upload_url( ) -> _models.FileUploadURLResponse: """Gets the file upload URL of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1418,13 +1454,13 @@ def get_file_upload_url( ) -> _models.FileUploadURLResponse: """Gets the file upload URL of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str :param parameters: Parameters supplied to the Test Base Account GetFileUploadURL operation. Is - either a model type or a IO type. Default value is None. + either a GetFileUploadURLParameters type or a IO type. Default value is None. :type parameters: ~azure.mgmt.testbase.models.GetFileUploadURLParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1445,16 +1481,14 @@ def get_file_upload_url( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.FileUploadURLResponse] + 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.FileUploadURLResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: if parameters is not None: @@ -1475,10 +1509,11 @@ def get_file_upload_url( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1495,7 +1530,9 @@ def get_file_upload_url( return deserialized - get_file_upload_url.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getFileUploadUrl"} # type: ignore + get_file_upload_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getFileUploadUrl" + } @overload def check_package_name_availability( @@ -1509,7 +1546,7 @@ def check_package_name_availability( ) -> _models.CheckNameAvailabilityResult: """Checks that the Test Base Package name and version is valid and is not already in use. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1538,7 +1575,7 @@ def check_package_name_availability( ) -> _models.CheckNameAvailabilityResult: """Checks that the Test Base Package name and version is valid and is not already in use. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -1565,13 +1602,13 @@ def check_package_name_availability( ) -> _models.CheckNameAvailabilityResult: """Checks that the Test Base Package name and version is valid and is not already in use. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str :param parameters: Parameters supplied to the Test Base Package CheckNameAvailability - operation. Is either a model type or a IO type. Required. + operation. Is either a PackageCheckNameAvailabilityParameters type or a IO type. Required. :type parameters: ~azure.mgmt.testbase.models.PackageCheckNameAvailabilityParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1592,16 +1629,14 @@ def check_package_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityResult] + 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.CheckNameAvailabilityResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PackageCheckNameAvailabilityParameters") @@ -1619,10 +1654,11 @@ def check_package_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1639,4 +1675,6 @@ def check_package_name_availability( return deserialized - check_package_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/checkPackageNameAvailability"} # type: ignore + check_package_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/checkPackageNameAvailability" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_results_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_results_operations.py index 1d94c5ebdc72..c25c869fe5f1 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_results_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_results_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,9 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,12 +60,21 @@ def build_list_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["osUpdateType"] = _SERIALIZER.query("os_update_type", os_update_type, "str") @@ -96,9 +99,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,13 +109,22 @@ def build_get_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), "testResultName": _SERIALIZER.url("test_result_name", test_result_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,9 +146,7 @@ def build_get_download_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,13 +156,22 @@ def build_get_download_url_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), "testResultName": _SERIALIZER.url("test_result_name", test_result_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -176,9 +193,7 @@ def build_get_video_download_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,13 +203,22 @@ def build_get_video_download_url_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), "testResultName": _SERIALIZER.url("test_result_name", test_result_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -216,10 +240,8 @@ def build_get_console_log_download_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -229,13 +251,22 @@ def build_get_console_log_download_url_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), - "packageName": _SERIALIZER.url("package_name", package_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "packageName": _SERIALIZER.url( + "package_name", package_name, "str", pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$" + ), "testResultName": _SERIALIZER.url("test_result_name", test_result_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -280,15 +311,15 @@ def list( """Lists all the Test Results with specified OS Update type for a Test Base Package. Can be filtered by osName, releaseName, flightingRing, buildVersion, buildRevision. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. :type test_base_account_name: str :param package_name: The resource name of the Test Base Package. Required. :type package_name: str - :param os_update_type: The type of the OS Update. Known values are: "SecurityUpdate" and - "FeatureUpdate". Required. + :param os_update_type: The type of the OS Update. Known values are: "SecurityUpdate", + "FeatureUpdate", and "InplaceUpgrade". Required. :type os_update_type: str or ~azure.mgmt.testbase.models.OsUpdateType :param filter: Odata filter. Default value is None. :type filter: str @@ -300,10 +331,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestResultListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestResultListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -329,7 +358,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -345,7 +374,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -353,14 +382,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TestResultListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -373,7 +403,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults" + } @distributed_trace def get( @@ -386,7 +418,7 @@ def get( ) -> _models.TestResultResource: """Get the Test Result by Id with specified OS Update type for a Test Base Package. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -412,10 +444,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestResultResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestResultResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -429,10 +459,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -449,7 +480,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}" + } @distributed_trace def get_download_url( @@ -462,7 +495,7 @@ def get_download_url( ) -> _models.DownloadURLResponse: """Gets the download URL of the test result. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -488,10 +521,8 @@ def get_download_url( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadURLResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DownloadURLResponse] = kwargs.pop("cls", None) request = build_get_download_url_request( resource_group_name=resource_group_name, @@ -505,10 +536,11 @@ def get_download_url( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -525,7 +557,9 @@ def get_download_url( return deserialized - get_download_url.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getDownloadUrl"} # type: ignore + get_download_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getDownloadUrl" + } @distributed_trace def get_video_download_url( @@ -538,7 +572,7 @@ def get_video_download_url( ) -> _models.DownloadURLResponse: """Gets the download URL of the test execution screen recording. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -564,10 +598,8 @@ def get_video_download_url( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadURLResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DownloadURLResponse] = kwargs.pop("cls", None) request = build_get_video_download_url_request( resource_group_name=resource_group_name, @@ -581,10 +613,11 @@ def get_video_download_url( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -601,7 +634,9 @@ def get_video_download_url( return deserialized - get_video_download_url.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getVideoDownloadUrl"} # type: ignore + get_video_download_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getVideoDownloadUrl" + } @overload def get_console_log_download_url( @@ -617,7 +652,7 @@ def get_console_log_download_url( ) -> _models.DownloadURLResponse: """Gets the download URL of the test execution console log file. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -653,7 +688,7 @@ def get_console_log_download_url( ) -> _models.DownloadURLResponse: """Gets the download URL of the test execution console log file. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -687,7 +722,7 @@ def get_console_log_download_url( ) -> _models.DownloadURLResponse: """Gets the download URL of the test execution console log file. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -698,7 +733,7 @@ def get_console_log_download_url( Required. :type test_result_name: str :param parameters: Parameters supplied to the Test Result GetConsoleLogDownloadUrl operation. - Is either a model type or a IO type. Required. + Is either a TestResultConsoleLogDownloadURLParameters type or a IO type. Required. :type parameters: ~azure.mgmt.testbase.models.TestResultConsoleLogDownloadURLParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -719,16 +754,14 @@ def get_console_log_download_url( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadURLResponse] + 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.DownloadURLResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TestResultConsoleLogDownloadURLParameters") @@ -748,10 +781,11 @@ def get_console_log_download_url( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -768,4 +802,6 @@ def get_console_log_download_url( return deserialized - get_console_log_download_url.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getConsoleLogDownloadUrl"} # type: ignore + get_console_log_download_url.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getConsoleLogDownloadUrl" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_summaries_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_summaries_operations.py index f0306a56a576..5dacfab1a064 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_summaries_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_summaries_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +42,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,11 +52,18 @@ def build_list_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,9 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,12 +90,19 @@ def build_get_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), "testSummaryName": _SERIALIZER.url("test_summary_name", test_summary_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -133,7 +138,7 @@ def list( ) -> Iterable["_models.TestSummaryResource"]: """Lists the Test Summaries of all the packages under a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -146,10 +151,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestSummaryListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestSummaryListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -172,7 +175,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -188,7 +191,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -196,14 +199,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TestSummaryListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -216,7 +220,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testSummaries"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testSummaries" + } @distributed_trace def get( @@ -225,7 +231,7 @@ def get( """Gets a Test Summary with specific name from all the Test Summaries of all the packages under a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -248,10 +254,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestSummaryResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestSummaryResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -264,10 +268,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -284,4 +289,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testSummaries/{testSummaryName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testSummaries/{testSummaryName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_types_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_types_operations.py index 615fef3a3156..926a1055be6c 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_types_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_test_types_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +42,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,11 +52,18 @@ def build_list_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,9 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,12 +94,19 @@ def build_get_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), "testTypeResourceName": _SERIALIZER.url("test_type_resource_name", test_type_resource_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +142,7 @@ def list( ) -> Iterable["_models.TestTypeResource"]: """Lists all the test types of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -150,10 +155,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestTypeListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestTypeListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -176,7 +179,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -192,7 +195,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -200,14 +203,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TestTypeListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -220,7 +224,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testTypes"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testTypes" + } @distributed_trace def get( @@ -228,7 +234,7 @@ def get( ) -> _models.TestTypeResource: """Gets a test type of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -251,10 +257,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestTypeResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestTypeResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -267,10 +271,11 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -287,4 +292,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testTypes/{testTypeResourceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testTypes/{testTypeResourceName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_usage_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_usage_operations.py index 85bb2f9743f3..2a6c844f2152 100644 --- a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_usage_operations.py +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_usage_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request -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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,9 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", "2022-04-01-preview") - ) # type: Literal["2022-04-01-preview"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,11 +57,18 @@ def build_list_request( ) # 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"), - "testBaseAccountName": _SERIALIZER.url("test_base_account_name", test_base_account_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -106,7 +106,7 @@ def list( ) -> Iterable["_models.TestBaseAccountUsageData"]: """Lists the usage data of a Test Base Account. - :param resource_group_name: The name of the resource group that contains the resource. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param test_base_account_name: The resource name of the Test Base Account. Required. @@ -122,10 +122,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-04-01-preview"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TestBaseAccountUsageDataList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TestBaseAccountUsageDataList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -149,7 +147,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -165,7 +163,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -173,14 +171,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("TestBaseAccountUsageDataList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -193,4 +192,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/usages"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/usages" + } diff --git a/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_vhds_operations.py b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_vhds_operations.py new file mode 100644 index 000000000000..faf13dd5a09a --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/azure/mgmt/testbase/operations/_vhds_operations.py @@ -0,0 +1,396 @@ +# pylint: disable=too-many-lines +# 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, Callable, Dict, Iterable, Optional, TypeVar +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_list_by_test_base_account_request( + resource_group_name: str, test_base_account_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/vhds", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, test_base_account_name: str, vhd_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/vhds/{vhdName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "vhdName": _SERIALIZER.url("vhd_name", vhd_name, "str", 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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, test_base_account_name: str, vhd_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-11-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/vhds/{vhdName}", + ) # 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 + ), + "testBaseAccountName": _SERIALIZER.url( + "test_base_account_name", + test_base_account_name, + "str", + pattern=r"^[A-Za-z0-9]([A-Za-z0-9_]|([-. ][A-Za-z0-9]))+$", + ), + "vhdName": _SERIALIZER.url("vhd_name", vhd_name, "str", 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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class VHDsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.testbase.TestBase`'s + :attr:`vhds` 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 list_by_test_base_account( + self, resource_group_name: str, test_base_account_name: str, **kwargs: Any + ) -> Iterable["_models.VHDResource"]: + """Lists all the VHDs under a test base account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VHDResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.testbase.models.VHDResource] + :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.VHDListResult] = 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_test_base_account_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_test_base_account.metadata["url"], + 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("VHDListResult", 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) + + list_by_test_base_account.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/vhds" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, test_base_account_name: str, vhd_name: str, **kwargs: Any + ) -> None: + """Deletes a Test Base VHD. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param vhd_name: The resource name of the Test Base VHD. Required. + :type vhd_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: + """ + 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, + test_base_account_name=test_base_account_name, + vhd_name=vhd_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) + + _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, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/vhds/{vhdName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, test_base_account_name: str, vhd_name: str, **kwargs: Any + ) -> _models.VHDResource: + """Gets a Test Base VHD. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param test_base_account_name: The resource name of the Test Base Account. Required. + :type test_base_account_name: str + :param vhd_name: The resource name of the Test Base VHD. Required. + :type vhd_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VHDResource or the result of cls(response) + :rtype: ~azure.mgmt.testbase.models.VHDResource + :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.VHDResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + test_base_account_name=test_base_account_name, + vhd_name=vhd_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) + + _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("VHDResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/vhds/{vhdName}" + } diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/action_request_delete.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/action_request_delete.py new file mode 100644 index 000000000000..69114937fd34 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/action_request_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python action_request_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.action_requests.delete( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + action_request_name="167184141414254", + ) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/ActionRequestDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/action_request_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/action_request_get.py new file mode 100644 index 000000000000..03d20c934842 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/action_request_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python action_request_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.action_requests.get( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + action_request_name="167184141414254", + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/ActionRequestGet.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/action_request_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/action_request_list.py new file mode 100644 index 000000000000..915e1e91a060 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/action_request_list.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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python action_request_list.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.action_requests.list( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/ActionRequestList.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/action_request_put.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/action_request_put.py new file mode 100644 index 000000000000..504a01241dd6 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/action_request_put.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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python action_request_put.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.action_requests.put( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + action_request_name="167184141414254", + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/ActionRequestPut.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/available_inplace_upgrade_os_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/available_inplace_upgrade_os_get.py new file mode 100644 index 000000000000..28f5527a897d --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/available_inplace_upgrade_os_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python available_inplace_upgrade_os_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.available_inplace_upgrade_os.get( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + available_inplace_upgrade_os_resource_name="Windows-10-1903", + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/AvailableInplaceUpgradeOSGet.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/available_os_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/available_os_get.py index 214bb59d7eb5..209d20217023 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/available_os_get.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/available_os_get.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.available_os.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/AvailableOSGet.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/AvailableOSGet.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/available_oss_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/available_oss_list.py index 8e3874503f65..13ba61ae9f23 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/available_oss_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/available_oss_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.available_os.list( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/AvailableOSsList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/AvailableOSsList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/billing_hub_get_free_hour_balance.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/billing_hub_get_free_hour_balance.py index aaee4fe6d2b4..142f51329132 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/billing_hub_get_free_hour_balance.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/billing_hub_get_free_hour_balance.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.billing_hub_service.get_free_hour_balance( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/BillingHubGetFreeHourBalance.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/BillingHubGetFreeHourBalance.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/billing_hub_get_usage.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/billing_hub_get_usage.py index daefa20f0b74..107c48569a9c 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/billing_hub_get_usage.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/billing_hub_get_usage.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="7b053408-0960-40b0-b950-99b0461aa9a8", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.billing_hub_service.get_usage( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/BillingHubGetUsage.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/BillingHubGetUsage.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/chat_session_chat.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/chat_session_chat.py new file mode 100644 index 000000000000..9396cc088e74 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/chat_session_chat.py @@ -0,0 +1,43 @@ +# 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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python chat_session_chat.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.chat_session.begin_chat( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + chat_session_name="e7520e9c-4017-4a92-aff2-d168670bb8ba", + parameters={"question": "What is Test Base for Microsoft 365?"}, + ).result() + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/ChatSessionChat.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/chat_session_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/chat_session_get.py new file mode 100644 index 000000000000..c553437f065e --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/chat_session_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python chat_session_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.chat_sessions.get( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + chat_session_name="e7520e9c-4017-4a92-aff2-d168670bb8ba", + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/ChatSessionGet.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/chat_session_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/chat_session_list.py new file mode 100644 index 000000000000..986312afa628 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/chat_session_list.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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python chat_session_list.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.chat_sessions.list( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/ChatSessionList.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/check_image_name_availability.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/check_image_name_availability.py new file mode 100644 index 000000000000..c2a4536a2f4e --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/check_image_name_availability.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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python check_image_name_availability.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.custom_images.check_image_name_availability( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + parameters={"definitionName": "contoso-image-def", "versionName": "contoso-image-ver"}, + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CheckImageNameAvailability.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/check_package_name_availability.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/check_package_name_availability.py index 3570410a99de..90439ba6efd4 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/check_package_name_availability.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/check_package_name_availability.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.test_base_accounts.check_package_name_availability( @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/CheckPackageNameAvailability.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CheckPackageNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/cpu_regression_analysis_result_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/cpu_regression_analysis_result_get.py index cad98a083dc4..c20f049374d8 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/cpu_regression_analysis_result_get.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/cpu_regression_analysis_result_get.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.analysis_results.get( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/CPURegressionAnalysisResultGet.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CPURegressionAnalysisResultGet.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/cpu_regression_analysis_results_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/cpu_regression_analysis_results_list.py index 8fa159c78f6d..1f878b1a3d55 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/cpu_regression_analysis_results_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/cpu_regression_analysis_results_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.analysis_results.list( @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/CPURegressionAnalysisResultsList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CPURegressionAnalysisResultsList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/cpu_utilization_analysis_result_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/cpu_utilization_analysis_result_get.py index 79bcde51398c..9d1b5ca9fb18 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/cpu_utilization_analysis_result_get.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/cpu_utilization_analysis_result_get.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.analysis_results.get( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/CPUUtilizationAnalysisResultGet.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CPUUtilizationAnalysisResultGet.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/cpu_utilization_analysis_results_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/cpu_utilization_analysis_results_list.py index 0c54ddcd99f4..bda6a1ea5d03 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/cpu_utilization_analysis_results_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/cpu_utilization_analysis_results_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.analysis_results.list( @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/CPUUtilizationAnalysisResultsList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CPUUtilizationAnalysisResultsList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/credential_create.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/credential_create.py new file mode 100644 index 000000000000..6ea55f170046 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/credential_create.py @@ -0,0 +1,50 @@ +# 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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python credential_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.credentials.create( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + credential_name="contoso-credential", + parameters={ + "properties": { + "credentialType": "IntuneAccount", + "displayName": "contoso-credential", + "passwordKeyVaultSecretPath": "https://contoso-kv.vault.azure.net/secrets/contoso-kv-secret-password", + "userNameKeyVaultSecretPath": "https://contoso-kv.vault.azure.net/secrets/contoso-kv-secret-username", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CredentialCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/credential_delete.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/credential_delete.py new file mode 100644 index 000000000000..24115869b0e5 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/credential_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python credential_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.credentials.delete( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + credential_name="contoso-credential", + ) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CredentialDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/credential_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/credential_get.py new file mode 100644 index 000000000000..bf8629aa1c42 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/credential_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python credential_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.credential.get( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + credential_name="contoso-credential", + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CredentialGet.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/credential_update.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/credential_update.py new file mode 100644 index 000000000000..e3e14af257ba --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/credential_update.py @@ -0,0 +1,50 @@ +# 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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python credential_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.credentials.update( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + credential_name="contoso-credential", + parameters={ + "properties": { + "credentialType": "IntuneAccount", + "displayName": "contoso-credential", + "passwordKeyVaultSecretPath": "https://contoso-kv.vault.azure.net/secrets/contoso-kv-secret-password", + "userNameKeyVaultSecretPath": "https://contoso-kv.vault.azure.net/secrets/contoso-kv-secret-username", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CredentialUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/credentials_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/credentials_list.py new file mode 100644 index 000000000000..d22ef4bb5b0b --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/credentials_list.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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python credentials_list.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.credential.list_by_test_base_account( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CredentialsList.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/custom_image_create.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/custom_image_create.py new file mode 100644 index 000000000000..c4eca6c4030b --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/custom_image_create.py @@ -0,0 +1,50 @@ +# 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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python custom_image_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.custom_images.begin_create( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + custom_image_name="image-2cfb2edc-13bc-4d54-8d6e-38b2a233b003", + parameters={ + "properties": { + "definitionName": "contoso-image-def", + "source": "VHD", + "versionName": "1.0.0", + "vhdId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/VHDs/vhd-00ac3ccd-1503-4ee5-aa26-26569cfafe88", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CustomImageCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/custom_image_delete.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/custom_image_delete.py new file mode 100644 index 000000000000..83645207a395 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/custom_image_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python custom_image_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.custom_images.begin_delete( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + custom_image_name="image-2cfb2edc-13bc-4d54-8d6e-38b2a233b003", + ).result() + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CustomImageDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/custom_image_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/custom_image_get.py new file mode 100644 index 000000000000..f857cf0a200c --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/custom_image_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python custom_image_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.custom_images.get( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + custom_image_name="image-2cfb2edc-13bc-4d54-8d6e-38b2a233b003", + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CustomImageGet.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/custom_images_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/custom_images_list.py new file mode 100644 index 000000000000..4880ca2b0013 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/custom_images_list.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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python custom_images_list.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.custom_images.list_by_test_base_account( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CustomImagesList.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/customer_event_create.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/customer_event_create.py index ff5b2a648265..6b5e353c4cb6 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/customer_event_create.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/customer_event_create.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.customer_events.begin_create( @@ -56,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/CustomerEventCreate.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CustomerEventCreate.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/customer_event_delete.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/customer_event_delete.py index 3749302a7d2d..a2dc0a85b460 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/customer_event_delete.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/customer_event_delete.py @@ -26,17 +26,16 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.customer_events.begin_delete( + client.customer_events.begin_delete( resource_group_name="contoso-rg1", test_base_account_name="contoso-testBaseAccount1", customer_event_name="WeeklySummary", ).result() - print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/CustomerEventDelete.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CustomerEventDelete.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/customer_event_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/customer_event_get.py index c0958ef60844..5f2948cc63d2 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/customer_event_get.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/customer_event_get.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.customer_events.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/CustomerEventGet.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CustomerEventGet.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/customer_events_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/customer_events_list.py index acdddbe343e9..838fde94e06f 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/customer_events_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/customer_events_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.customer_events.list_by_test_base_account( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/CustomerEventsList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/CustomerEventsList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_copy_from_package.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_copy_from_package.py new file mode 100644 index 000000000000..cc4358708b4b --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_copy_from_package.py @@ -0,0 +1,44 @@ +# 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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python draft_package_copy_from_package.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.draft_packages.begin_copy_from_package( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + draft_package_name="61d99543-14ff-47ae-bf03-8a8b8445502e", + parameters={ + "packageId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-rg/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount/packages/contoso-package" + }, + ).result() + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/DraftPackageCopyFromPackage.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_create.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_create.py new file mode 100644 index 000000000000..a50e4316ec54 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_create.py @@ -0,0 +1,51 @@ +# 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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python draft_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.draft_packages.create( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + draft_package_name="61d99543-14ff-47ae-bf03-8a8b8445502e", + parameters={ + "properties": { + "appFileName": "TestBaseM365DigitalClock.msi", + "applicationName": "contoso-package", + "sourceType": "Native", + "useSample": False, + "version": "1.0", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/DraftPackageCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_delete.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_delete.py new file mode 100644 index 000000000000..16b4241e6614 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python draft_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.draft_packages.delete( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + draft_package_name="61d99543-14ff-47ae-bf03-8a8b8445502e", + ) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/DraftPackageDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_extract_file.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_extract_file.py new file mode 100644 index 000000000000..f2d428c4d681 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_extract_file.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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python draft_package_extract_file.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.draft_packages.begin_extract_file( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + draft_package_name="34070901-fc0b-4459-b6de-4295b7c7bf19", + parameters={"fileType": "IntuneWinPackage", "sourceFile": "bin/contoso.intunewin"}, + ).result() + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/DraftPackageExtractFile.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_generate_folders_and_scripts.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_generate_folders_and_scripts.py new file mode 100644 index 000000000000..71f7ab834d2c --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_generate_folders_and_scripts.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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python draft_package_generate_folders_and_scripts.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.draft_packages.begin_generate_folders_and_scripts( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + draft_package_name="61d99543-14ff-47ae-bf03-8a8b8445502e", + parameters={"forceGenerate": False}, + ).result() + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/DraftPackageGenerateFoldersAndScripts.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_get.py new file mode 100644 index 000000000000..29c8b7ebfe90 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python draft_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.draft_packages.get( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + draft_package_name="61d99543-14ff-47ae-bf03-8a8b8445502e", + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/DraftPackageGet.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_get_path.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_get_path.py new file mode 100644 index 000000000000..d398632e2ac7 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_get_path.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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python draft_package_get_path.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.draft_packages.get_path( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + draft_package_name="61d99543-14ff-47ae-bf03-8a8b8445502e", + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/DraftPackageGetPath.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_update.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_update.py new file mode 100644 index 000000000000..2b3051b6d7c6 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_package_update.py @@ -0,0 +1,55 @@ +# 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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python draft_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.draft_packages.update( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + draft_package_name="61d99543-14ff-47ae-bf03-8a8b8445502e", + parameters={ + "properties": { + "flightingRing": "Insider Beta Channel", + "targetOSList": [ + { + "baselineOSs": None, + "osUpdateType": "Security updates", + "targetOSs": ["Windows 11 21H2", "Windows 10 21H2", "Windows 10 21H1"], + }, + {"baselineOSs": None, "osUpdateType": "Feature updates", "targetOSs": ["Windows 10 21H2"]}, + ], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/DraftPackageUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_packages_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_packages_list.py new file mode 100644 index 000000000000..e0c44129df5f --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/draft_packages_list.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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python draft_packages_list.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.draft_packages.list_by_test_base_account( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/DraftPackagesList.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/email_event_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/email_event_get.py index 68cb4bd99e17..cf82f0cc45a8 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/email_event_get.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/email_event_get.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.email_events.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/EmailEventGet.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/EmailEventGet.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/email_events_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/email_events_list.py index 82863b982841..90fb0d584906 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/email_events_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/email_events_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.email_events.list( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/EmailEventsList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/EmailEventsList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/favorite_process_create.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/favorite_process_create.py index 3fab21d00791..792be1225177 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/favorite_process_create.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/favorite_process_create.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.favorite_processes.create( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/FavoriteProcessCreate.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/FavoriteProcessCreate.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/favorite_process_delete.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/favorite_process_delete.py index ac1ffe1a43ea..f99951ebbe01 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/favorite_process_delete.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/favorite_process_delete.py @@ -26,18 +26,17 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.favorite_processes.delete( + client.favorite_processes.delete( resource_group_name="contoso-rg1", test_base_account_name="contoso-testBaseAccount1", package_name="contoso-package2", favorite_process_resource_name="testAppProcess", ) - print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/FavoriteProcessDelete.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/FavoriteProcessDelete.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/favorite_process_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/favorite_process_get.py index 74ee65c7fd7f..0411429edc7c 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/favorite_process_get.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/favorite_process_get.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.favorite_processes.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/FavoriteProcessGet.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/FavoriteProcessGet.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/favorite_processes_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/favorite_processes_list.py index c0fca2e66795..bb2afc74cd41 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/favorite_processes_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/favorite_processes_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.favorite_processes.list( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/FavoriteProcessesList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/FavoriteProcessesList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/feature_update_supported_oses_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/feature_update_supported_oses_list.py new file mode 100644 index 000000000000..ce322a179282 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/feature_update_supported_oses_list.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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python feature_update_supported_oses_list.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.feature_update_supported_oses.list( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/FeatureUpdateSupportedOsesList.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/first_party_app_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/first_party_app_get.py new file mode 100644 index 000000000000..19b061e8be8f --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/first_party_app_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python first_party_app_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.first_party_apps.get( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + first_party_app_resource_name="firstPartyApp-fe51c56c-5dc0-499b-a807-a9d7746b34ae", + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/FirstPartyAppGet.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/first_party_apps_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/first_party_apps_list.py new file mode 100644 index 000000000000..1b0f6a051d98 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/first_party_apps_list.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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python first_party_apps_list.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.first_party_apps.list( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/FirstPartyAppsList.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/flighting_ring_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/flighting_ring_get.py index f92fc0d91916..843ddd9fe7db 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/flighting_ring_get.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/flighting_ring_get.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.flighting_rings.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/FlightingRingGet.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/FlightingRingGet.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/flighting_rings_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/flighting_rings_list.py index 34f69c171768..61ebae8122aa 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/flighting_rings_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/flighting_rings_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.flighting_rings.list( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/FlightingRingsList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/FlightingRingsList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/free_hour_balance_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/free_hour_balance_get.py new file mode 100644 index 000000000000..48f811920799 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/free_hour_balance_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python free_hour_balance_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.free_hour_balances.get( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + free_hour_balance_name="TenantLevel", + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/FreeHourBalanceGet.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/free_hour_balances_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/free_hour_balances_list.py new file mode 100644 index 000000000000..a36916693f76 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/free_hour_balances_list.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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python free_hour_balances_list.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.free_hour_balances.list( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/FreeHourBalancesList.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/gallery_app_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/gallery_app_get.py new file mode 100644 index 000000000000..aad6e8aa0caf --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/gallery_app_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python gallery_app_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.gallery_apps.get( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + gallery_app_name="fe51c56c-5dc0-499b-a807-a9d7746b34ae", + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/GalleryAppGet.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/gallery_app_sku_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/gallery_app_sku_get.py new file mode 100644 index 000000000000..ff078957985f --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/gallery_app_sku_get.py @@ -0,0 +1,43 @@ +# 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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python gallery_app_sku_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.gallery_app_skus.get( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + gallery_app_name="fe51c56c-5dc0-499b-a807-a9d7746b34ae", + gallery_app_sku_name="ec898a20-df1e-4483-83e7-4bb37bb77385", + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/GalleryAppSkuGet.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/gallery_apps_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/gallery_apps_list.py new file mode 100644 index 000000000000..20b0253ae167 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/gallery_apps_list.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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python gallery_apps_list.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.gallery_apps.list( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/GalleryAppsList.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/gallery_apps_skus_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/gallery_apps_skus_list.py new file mode 100644 index 000000000000..2ed4e4390c42 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/gallery_apps_skus_list.py @@ -0,0 +1,43 @@ +# 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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python gallery_apps_skus_list.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.gallery_app_skus.list( + resource_group_name="contoso-rg", + test_base_account_name="contoso-testBaseAccount", + gallery_app_name="fe51c56c-5dc0-499b-a807-a9d7746b34ae", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/GalleryAppsSkusList.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/image_definition_create.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/image_definition_create.py new file mode 100644 index 000000000000..a193518cab46 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/image_definition_create.py @@ -0,0 +1,43 @@ +# 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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python image_definition_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.image_definitions.create( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + image_definition_name="contoso-image-def", + parameters={"properties": {"architecture": "x64", "osState": "Generalized", "securityType": "Standard"}}, + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/ImageDefinitionCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/image_definition_delete.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/image_definition_delete.py new file mode 100644 index 000000000000..0974ee2edbab --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/image_definition_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python image_definition_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.image_definitions.delete( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + image_definition_name="contoso-image-def", + ) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/ImageDefinitionDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/image_definition_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/image_definition_get.py new file mode 100644 index 000000000000..e603dd11ebb1 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/image_definition_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python image_definition_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.image_definitions.get( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + image_definition_name="contoso-image-def", + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/ImageDefinitionGet.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/image_definitions_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/image_definitions_list.py new file mode 100644 index 000000000000..32da5a161256 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/image_definitions_list.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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python image_definitions_list.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.image_definitions.list_by_test_base_account( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/ImageDefinitionsList.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/memory_regression_analysis_result_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/memory_regression_analysis_result_get.py index cd809a31a446..87e55024288b 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/memory_regression_analysis_result_get.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/memory_regression_analysis_result_get.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.analysis_results.get( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/MemoryRegressionAnalysisResultGet.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/MemoryRegressionAnalysisResultGet.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/memory_regression_analysis_results_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/memory_regression_analysis_results_list.py index b82e8c3d8298..e86dd1083bfc 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/memory_regression_analysis_results_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/memory_regression_analysis_results_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.analysis_results.list( @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/MemoryRegressionAnalysisResultsList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/MemoryRegressionAnalysisResultsList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/memory_utilization_analysis_result_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/memory_utilization_analysis_result_get.py index 1622938d856b..77cf52b8fc0b 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/memory_utilization_analysis_result_get.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/memory_utilization_analysis_result_get.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.analysis_results.get( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/MemoryUtilizationAnalysisResultGet.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/MemoryUtilizationAnalysisResultGet.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/memory_utilization_analysis_results_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/memory_utilization_analysis_results_list.py index 826355a52361..4e8699d1d4b3 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/memory_utilization_analysis_results_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/memory_utilization_analysis_results_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.analysis_results.list( @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/MemoryUtilizationAnalysisResultsList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/MemoryUtilizationAnalysisResultsList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/operations_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/operations_list.py index 6b362d50b660..6590dbf44e81 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/operations_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/OperationsList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/OperationsList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/os_update_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/os_update_get.py index 7b6ceff363f8..1a58ab235942 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/os_update_get.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/os_update_get.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.os_updates.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/OSUpdateGet.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/OSUpdateGet.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/os_updates_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/os_updates_list.py index be1094fd9762..7be87a6d8af6 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/os_updates_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/os_updates_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.os_updates.list( @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/OSUpdatesList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/OSUpdatesList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/package_create.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/package_create.py index 0de673c48401..8de9cf2b6f7a 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/package_create.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/package_create.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.packages.begin_create( @@ -38,6 +38,15 @@ def main(): "properties": { "applicationName": "contoso-package2", "blobPath": "storageAccountPath/package.zip", + "firstPartyApps": [ + { + "architecture": "x64", + "channel": "Current Channel", + "interopExecutionMode": "firstPartyAppWithTests", + "name": "Office", + "ring": "Insider", + } + ], "flightingRing": "Insider Beta Channel", "targetOSList": [ {"osUpdateType": "Security updates", "targetOSs": ["Windows 10 2004", "Windows 10 1903"]} @@ -51,6 +60,7 @@ def main(): "applyUpdateBefore": False, "content": "app/scripts/install/job.ps1", "contentType": "Path", + "install1PAppBefore": True, "maxRunTime": 1800, "name": "Install", "restartAfter": True, @@ -63,6 +73,7 @@ def main(): "applyUpdateBefore": True, "content": "app/scripts/launch/job.ps1", "contentType": "Path", + "install1PAppBefore": False, "maxRunTime": 1800, "name": "Launch", "restartAfter": False, @@ -75,6 +86,7 @@ def main(): "applyUpdateBefore": False, "content": "app/scripts/close/job.ps1", "contentType": "Path", + "install1PAppBefore": False, "maxRunTime": 1800, "name": "Close", "restartAfter": False, @@ -87,6 +99,7 @@ def main(): "applyUpdateBefore": False, "content": "app/scripts/uninstall/job.ps1", "contentType": "Path", + "install1PAppBefore": False, "maxRunTime": 1800, "name": "Uninstall", "restartAfter": False, @@ -106,6 +119,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/PackageCreate.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/PackageCreate.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/package_delete.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/package_delete.py index 92c160c5d96b..8abb1dc21058 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/package_delete.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/package_delete.py @@ -26,17 +26,16 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.packages.begin_delete( + client.packages.begin_delete( resource_group_name="contoso-rg1", test_base_account_name="contoso-testBaseAccount1", package_name="contoso-package2", ).result() - print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/PackageDelete.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/PackageDelete.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/package_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/package_get.py index f12de910030f..cf1f0ced3ac9 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/package_get.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/package_get.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.packages.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/PackageGet.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/PackageGet.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/package_get_download_url.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/package_get_download_url.py index 6558ecc596c8..9813a06bbc93 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/package_get_download_url.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/package_get_download_url.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.packages.get_download_url( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/PackageGetDownloadURL.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/PackageGetDownloadURL.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/package_hard_delete.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/package_hard_delete.py index 2ada61e2acb0..7ce1de3f8aa4 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/package_hard_delete.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/package_hard_delete.py @@ -26,17 +26,16 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.packages.begin_hard_delete( + client.packages.begin_hard_delete( resource_group_name="contoso-rg1", test_base_account_name="contoso-testBaseAccount1", package_name="contoso-package2", ).result() - print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/PackageHardDelete.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/PackageHardDelete.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/package_run_test.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/package_run_test.py index 7f12597aa979..4ac8400d1247 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/package_run_test.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/package_run_test.py @@ -26,17 +26,16 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.packages.run_test( + client.packages.run_test( resource_group_name="contoso-rg1", test_base_account_name="contoso-testBaseAccount1", package_name="contoso-package2", ) - print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/PackageRunTest.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/PackageRunTest.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/package_update.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/package_update.py index 49f31cda51a3..e122b5c4b2f5 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/package_update.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/package_update.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.packages.begin_update( @@ -36,6 +36,15 @@ def main(): parameters={ "properties": { "blobPath": "storageAccountPath/package.zip", + "firstPartyApps": [ + { + "architecture": "x64", + "channel": "Current Channel", + "interopExecutionMode": "firstPartyAppWithTests", + "name": "Office", + "ring": "Insider", + } + ], "flightingRing": "Insider Beta Channel", "isEnabled": False, "targetOSList": [ @@ -50,6 +59,7 @@ def main(): "applyUpdateBefore": False, "content": "app/scripts/install/job.ps1", "contentType": "Path", + "install1PAppBefore": True, "maxRunTime": 1800, "name": "Install", "restartAfter": True, @@ -62,6 +72,7 @@ def main(): "applyUpdateBefore": True, "content": "app/scripts/launch/job.ps1", "contentType": "Path", + "install1PAppBefore": False, "maxRunTime": 1800, "name": "Launch", "restartAfter": False, @@ -74,6 +85,7 @@ def main(): "applyUpdateBefore": False, "content": "app/scripts/close/job.ps1", "contentType": "Path", + "install1PAppBefore": False, "maxRunTime": 1800, "name": "Close", "restartAfter": False, @@ -86,6 +98,7 @@ def main(): "applyUpdateBefore": False, "content": "app/scripts/uninstall/job.ps1", "contentType": "Path", + "install1PAppBefore": False, "maxRunTime": 1800, "name": "Uninstall", "restartAfter": False, @@ -104,6 +117,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/PackageUpdate.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/PackageUpdate.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/packages_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/packages_list.py index 6facd35b6cfa..fca603cb4351 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/packages_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/packages_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.packages.list_by_test_base_account( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/PackagesList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/PackagesList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/script_execution_analysis_result_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/script_execution_analysis_result_get.py index a3f29a6125f1..eb0442ca08f6 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/script_execution_analysis_result_get.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/script_execution_analysis_result_get.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.analysis_results.get( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/ScriptExecutionAnalysisResultGet.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/ScriptExecutionAnalysisResultGet.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/script_execution_analysis_results_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/script_execution_analysis_results_list.py index d681e2d0e852..70d5f9692d6b 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/script_execution_analysis_results_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/script_execution_analysis_results_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.analysis_results.list( @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/ScriptExecutionAnalysisResultsList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/ScriptExecutionAnalysisResultsList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_create.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_create.py index 2bd7a5a35a90..875d8b3a99f2 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_create.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_create.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.test_base_accounts.begin_create( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestBaseAccountCreate.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestBaseAccountCreate.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_delete.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_delete.py index 32694cf2538e..efbd5051a604 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_delete.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_delete.py @@ -26,16 +26,15 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.test_base_accounts.begin_delete( + client.test_base_accounts.begin_delete( resource_group_name="contoso-rg1", test_base_account_name="contoso-testBaseAccount1", ).result() - print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestBaseAccountDelete.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestBaseAccountDelete.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_get.py index 328a1014e463..315bb247eb12 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_get.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_get.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.test_base_accounts.get( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestBaseAccountGet.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestBaseAccountGet.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_get_file_upload_url.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_get_file_upload_url.py index 70177bc8aa4c..294cd645c077 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_get_file_upload_url.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_get_file_upload_url.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.test_base_accounts.get_file_upload_url( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestBaseAccountGetFileUploadUrl.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestBaseAccountGetFileUploadUrl.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_offboard.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_offboard.py index 17c8510fc74f..6b7d0515e7ff 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_offboard.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_offboard.py @@ -26,16 +26,15 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.test_base_accounts.begin_offboard( + client.test_base_accounts.begin_offboard( resource_group_name="contoso-rg1", test_base_account_name="contoso-testBaseAccount1", ).result() - print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestBaseAccountOffboard.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestBaseAccountOffboard.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_sk_us_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_sk_us_list.py index 588f161d29d0..05cf84a2af5c 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_sk_us_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_sk_us_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.skus.list() @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestBaseAccountSKUsList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestBaseAccountSKUsList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_update.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_update.py index 672ce2da5e53..16491f91f1fc 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_update.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_update.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.test_base_accounts.begin_update( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestBaseAccountUpdate.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestBaseAccountUpdate.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_usages_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_usages_list.py index b582fe69e2ad..14ca4c62d690 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_usages_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_account_usages_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.usage.list( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestBaseAccountUsagesList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestBaseAccountUsagesList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_accounts_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_accounts_list.py index bef17ea1fbab..8a93542ec611 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_accounts_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_accounts_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.test_base_accounts.list_by_resource_group( @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestBaseAccountsList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestBaseAccountsList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_accounts_list_by_subscription.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_accounts_list_by_subscription.py index 4887ae2463f3..8110fcdde92f 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_accounts_list_by_subscription.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_base_accounts_list_by_subscription.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.test_base_accounts.list_by_subscription() @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestBaseAccountsListBySubscription.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestBaseAccountsListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_result_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_result_get.py index e12f4a580426..5b0bf2131f8f 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_result_get.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_result_get.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.test_results.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestResultGet.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestResultGet.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_result_get_console_log_download_url.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_result_get_console_log_download_url.py index dd6d074154af..92f960e3f820 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_result_get_console_log_download_url.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_result_get_console_log_download_url.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.test_results.get_console_log_download_url( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestResultGetConsoleLogDownloadURL.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestResultGetConsoleLogDownloadURL.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_result_get_download_url.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_result_get_download_url.py index 7462e8bac1b3..747a5e1f8d4d 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_result_get_download_url.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_result_get_download_url.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.test_results.get_download_url( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestResultGetDownloadURL.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestResultGetDownloadURL.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_result_get_video_download_url.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_result_get_video_download_url.py index 36b8aba6e984..6acdb2c48248 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_result_get_video_download_url.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_result_get_video_download_url.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.test_results.get_video_download_url( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestResultGetVideoDownloadURL.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestResultGetVideoDownloadURL.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_results_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_results_list.py index f9c1f9c18dc6..fca2a71d7a02 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_results_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_results_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.test_results.list( @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestResultsList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestResultsList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_summaries_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_summaries_list.py index 5eea8aff6d27..1bb8b32a9941 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_summaries_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_summaries_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.test_summaries.list( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestSummariesList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestSummariesList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_summary_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_summary_get.py index 61fa731b3fd1..79f9136ad623 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_summary_get.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_summary_get.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.test_summaries.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestSummaryGet.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestSummaryGet.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_type_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_type_get.py index a408ce039009..cd56068dc56d 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_type_get.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_type_get.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.test_types.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestTypeGet.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestTypeGet.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_types_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_types_list.py index f3c1d99f9e9e..5d09c75e5f4f 100644 --- a/sdk/testbase/azure-mgmt-testbase/generated_samples/test_types_list.py +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/test_types_list.py @@ -26,7 +26,7 @@ def main(): client = TestBase( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.test_types.list( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2022-04-01-preview/examples/TestTypesList.json +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/TestTypesList.json if __name__ == "__main__": main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/vh_ds_list.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/vh_ds_list.py new file mode 100644 index 000000000000..a2e3275e503c --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/vh_ds_list.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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python vh_ds_list.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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.vhds.list_by_test_base_account( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/VHDsList.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/vhd_delete.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/vhd_delete.py new file mode 100644 index 000000000000..001954877bbc --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/vhd_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python vhd_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.vhds.delete( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + vhd_name="vhd-00ac3ccd-1503-4ee5-aa26-26569cfafe88", + ) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/VHDDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/testbase/azure-mgmt-testbase/generated_samples/vhd_get.py b/sdk/testbase/azure-mgmt-testbase/generated_samples/vhd_get.py new file mode 100644 index 000000000000..ab5f1a55fdc4 --- /dev/null +++ b/sdk/testbase/azure-mgmt-testbase/generated_samples/vhd_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.testbase import TestBase + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-testbase +# USAGE + python vhd_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 = TestBase( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.vhds.get( + resource_group_name="contoso-rg1", + test_base_account_name="contoso-testBaseAccount1", + vhd_name="vhd-00ac3ccd-1503-4ee5-aa26-26569cfafe88", + ) + print(response) + + +# x-ms-original-file: specification/testbase/resource-manager/Microsoft.TestBase/preview/2023-11-01-preview/examples/VHDGet.json +if __name__ == "__main__": + main()