diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/__init__.py index 78b8b4b91a49..5dd939c1975e 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "ContainerServiceFleetMgmtClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_configuration.py index 272c39b1f573..60371c9ab758 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_configuration.py @@ -14,7 +14,6 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -28,13 +27,13 @@ class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many- :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-04-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: - api_version: str = kwargs.pop("api_version", "2024-04-01") + api_version: str = kwargs.pop("api_version", "2025-04-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_container_service_fleet_mgmt_client.py index 748b6e7f48cd..5b8fc0eca94b 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_container_service_fleet_mgmt_client.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_container_service_fleet_mgmt_client.py @@ -19,6 +19,7 @@ from ._configuration import ContainerServiceFleetMgmtClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + AutoUpgradeProfilesOperations, FleetMembersOperations, FleetUpdateStrategiesOperations, FleetsOperations, @@ -27,17 +28,19 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword +class ContainerServiceFleetMgmtClient: """Azure Kubernetes Fleet Manager api client. :ivar operations: Operations operations :vartype operations: azure.mgmt.containerservicefleet.operations.Operations :ivar fleets: FleetsOperations operations :vartype fleets: azure.mgmt.containerservicefleet.operations.FleetsOperations + :ivar auto_upgrade_profiles: AutoUpgradeProfilesOperations operations + :vartype auto_upgrade_profiles: + azure.mgmt.containerservicefleet.operations.AutoUpgradeProfilesOperations :ivar fleet_members: FleetMembersOperations operations :vartype fleet_members: azure.mgmt.containerservicefleet.operations.FleetMembersOperations :ivar update_runs: UpdateRunsOperations operations @@ -51,8 +54,8 @@ class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-ver :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 "2024-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-04-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 Retry-After header is present. @@ -94,6 +97,9 @@ def __init__( self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.fleets = FleetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.auto_upgrade_profiles = AutoUpgradeProfilesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.fleet_members = FleetMembersOperations(self._client, self._config, self._serialize, self._deserialize) self.update_runs = UpdateRunsOperations(self._client, self._config, self._serialize, self._deserialize) self.fleet_update_strategies = FleetUpdateStrategiesOperations( diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_serialization.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_serialization.py index 8139854b97bb..b24ab2885450 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_serialization.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_serialization.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. @@ -24,7 +25,6 @@ # # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -52,7 +52,6 @@ MutableMapping, Type, List, - Mapping, ) try: @@ -91,6 +90,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +113,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -155,6 +156,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -184,15 +190,30 @@ class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" def utcoffset(self, dt): - """UTF offset for UTC is 0.""" + """UTF offset for UTC is 0. + + :param datetime.datetime dt: The datetime + :returns: The offset + :rtype: datetime.timedelta + """ return datetime.timedelta(0) def tzname(self, dt): - """Timestamp representation.""" + """Timestamp representation. + + :param datetime.datetime dt: The datetime + :returns: The timestamp representation + :rtype: str + """ return "Z" def dst(self, dt): - """No daylight saving for UTC.""" + """No daylight saving for UTC. + + :param datetime.datetime dt: The datetime + :returns: The daylight saving time + :rtype: datetime.timedelta + """ return datetime.timedelta(hours=1) @@ -206,7 +227,7 @@ class _FixedOffset(datetime.tzinfo): # type: ignore :param datetime.timedelta offset: offset in timedelta format """ - def __init__(self, offset): + def __init__(self, offset) -> None: self.__offset = offset def utcoffset(self, dt): @@ -235,24 +256,26 @@ def __getinitargs__(self): _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items 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__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -300,13 +330,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -326,7 +366,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -346,7 +390,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -380,12 +426,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -395,7 +444,7 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @@ -408,6 +457,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @@ -426,9 +476,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -448,21 +500,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -501,11 +557,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -540,7 +598,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -560,13 +618,16 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict :raises: SerializationError if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -592,12 +653,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -633,7 +696,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): 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 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", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -664,17 +728,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict :raises: SerializationError if serialization fails. :raises: ValueError if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -703,7 +767,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -712,9 +776,11 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str + :returns: The serialized URL path :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -728,21 +794,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object 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, list :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -759,19 +824,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -780,21 +846,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None :raises: AttributeError if required data is None. :raises: ValueError if data is None :raises: SerializationError if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -805,7 +870,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -821,11 +886,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -841,23 +905,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -871,8 +938,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -882,15 +948,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - 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 + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -945,9 +1009,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -971,7 +1034,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -979,6 +1042,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1003,7 +1067,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1034,56 +1098,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: 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}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1091,11 +1160,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1105,30 +1175,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: TypeError if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1141,12 +1213,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: SerializationError if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1172,13 +1245,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int :raises: SerializationError if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1186,11 +1260,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1211,7 +1285,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1232,17 +1308,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1279,7 +1367,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1331,22 +1419,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1354,7 +1441,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1363,9 +1450,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - 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}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1403,11 +1490,12 @@ def __call__(self, target_obj, response_data, content_type=None): :param str content_type: Swagger "produces" if available. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree @@ -1416,12 +1504,13 @@ def _deserialize(self, target_obj, data): :param object data: Object to deserialize. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1440,13 +1529,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1476,9 +1565,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1505,6 +1593,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1516,7 +1606,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1531,10 +1621,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1552,10 +1644,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1579,24 +1673,35 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1605,15 +1710,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1627,7 +1733,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1647,14 +1757,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1671,6 +1781,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1681,11 +1792,12 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict :raises: TypeError if non-builtin datatype encountered. """ @@ -1720,11 +1832,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1732,6 +1843,7 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool :raises: TypeError if string format is not valid. """ @@ -1743,24 +1855,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1768,6 +1879,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1781,8 +1893,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1794,6 +1905,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1804,9 +1916,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1822,6 +1934,7 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1834,6 +1947,7 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1849,8 +1963,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal + :return: Deserialized decimal :raises: DeserializationError if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1865,6 +1980,7 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int :raises: ValueError if string format invalid. """ @@ -1877,6 +1993,7 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta :raises: DeserializationError if string format invalid. """ @@ -1887,14 +2004,14 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date :raises: DeserializationError if string format invalid. """ @@ -1910,6 +2027,7 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time :raises: DeserializationError if string format invalid. """ @@ -1924,6 +2042,7 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1939,14 +2058,14 @@ def deserialize_rfc(attr): except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1976,8 +2095,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1985,6 +2103,7 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime :raises: DeserializationError if format invalid """ @@ -1996,5 +2115,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/__init__.py index af1d7b0b47fe..ba8c8dae6379 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "ContainerServiceFleetMgmtClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_configuration.py index 8473d07bde9c..edcf6d7be43a 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_configuration.py @@ -14,7 +14,6 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -28,13 +27,13 @@ class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many- :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-04-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: - api_version: str = kwargs.pop("api_version", "2024-04-01") + api_version: str = kwargs.pop("api_version", "2025-04-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_container_service_fleet_mgmt_client.py index 0b14a61497c1..aec1ca66b6b8 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_container_service_fleet_mgmt_client.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_container_service_fleet_mgmt_client.py @@ -19,6 +19,7 @@ from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceFleetMgmtClientConfiguration from .operations import ( + AutoUpgradeProfilesOperations, FleetMembersOperations, FleetUpdateStrategiesOperations, FleetsOperations, @@ -27,17 +28,19 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword +class ContainerServiceFleetMgmtClient: """Azure Kubernetes Fleet Manager api client. :ivar operations: Operations operations :vartype operations: azure.mgmt.containerservicefleet.aio.operations.Operations :ivar fleets: FleetsOperations operations :vartype fleets: azure.mgmt.containerservicefleet.aio.operations.FleetsOperations + :ivar auto_upgrade_profiles: AutoUpgradeProfilesOperations operations + :vartype auto_upgrade_profiles: + azure.mgmt.containerservicefleet.aio.operations.AutoUpgradeProfilesOperations :ivar fleet_members: FleetMembersOperations operations :vartype fleet_members: azure.mgmt.containerservicefleet.aio.operations.FleetMembersOperations :ivar update_runs: UpdateRunsOperations operations @@ -51,8 +54,8 @@ class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-ver :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 "2024-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-04-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 Retry-After header is present. @@ -94,6 +97,9 @@ def __init__( self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.fleets = FleetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.auto_upgrade_profiles = AutoUpgradeProfilesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.fleet_members = FleetMembersOperations(self._client, self._config, self._serialize, self._deserialize) self.update_runs = UpdateRunsOperations(self._client, self._config, self._serialize, self._deserialize) self.fleet_update_strategies = FleetUpdateStrategiesOperations( diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/__init__.py index 2233c34e005a..9cc523c738ae 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/__init__.py @@ -5,23 +5,31 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations -from ._update_runs_operations import UpdateRunsOperations -from ._fleet_update_strategies_operations import FleetUpdateStrategiesOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._fleets_operations import FleetsOperations # type: ignore +from ._auto_upgrade_profiles_operations import AutoUpgradeProfilesOperations # type: ignore +from ._fleet_members_operations import FleetMembersOperations # type: ignore +from ._update_runs_operations import UpdateRunsOperations # type: ignore +from ._fleet_update_strategies_operations import FleetUpdateStrategiesOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "Operations", "FleetsOperations", + "AutoUpgradeProfilesOperations", "FleetMembersOperations", "UpdateRunsOperations", "FleetUpdateStrategiesOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_auto_upgrade_profiles_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_auto_upgrade_profiles_operations.py new file mode 100644 index 000000000000..8fcf99a0722e --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_auto_upgrade_profiles_operations.py @@ -0,0 +1,592 @@ +# 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 +import sys +from typing import Any, AsyncIterable, AsyncIterator, 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, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._auto_upgrade_profiles_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_fleet_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AutoUpgradeProfilesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservicefleet.aio.ContainerServiceFleetMgmtClient`'s + :attr:`auto_upgrade_profiles` 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_fleet( + self, resource_group_name: str, fleet_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AutoUpgradeProfile"]: + """List AutoUpgradeProfile resources by Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :return: An iterator like instance of either AutoUpgradeProfile or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile] + :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.AutoUpgradeProfileListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_fleet_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AutoUpgradeProfileListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, fleet_name: str, auto_upgrade_profile_name: str, **kwargs: Any + ) -> _models.AutoUpgradeProfile: + """Get a AutoUpgradeProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. + :type auto_upgrade_profile_name: str + :return: AutoUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = 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.AutoUpgradeProfile] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + auto_upgrade_profile_name=auto_upgrade_profile_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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("AutoUpgradeProfile", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + fleet_name: str, + auto_upgrade_profile_name: str, + resource: Union[_models.AutoUpgradeProfile, IO[bytes]], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "AutoUpgradeProfile") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + auto_upgrade_profile_name=auto_upgrade_profile_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + auto_upgrade_profile_name: str, + resource: _models.AutoUpgradeProfile, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutoUpgradeProfile]: + """Create a AutoUpgradeProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. + :type auto_upgrade_profile_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AutoUpgradeProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + auto_upgrade_profile_name: str, + resource: IO[bytes], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AutoUpgradeProfile]: + """Create a AutoUpgradeProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. + :type auto_upgrade_profile_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AutoUpgradeProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + auto_upgrade_profile_name: str, + resource: Union[_models.AutoUpgradeProfile, IO[bytes]], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.AutoUpgradeProfile]: + """Create a AutoUpgradeProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. + :type auto_upgrade_profile_name: str + :param resource: Resource create parameters. Is either a AutoUpgradeProfile type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile or IO[bytes] + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :return: An instance of AsyncLROPoller that returns either AutoUpgradeProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile] + :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.AutoUpgradeProfile] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + auto_upgrade_profile_name=auto_upgrade_profile_name, + resource=resource, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AutoUpgradeProfile", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.AutoUpgradeProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AutoUpgradeProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + fleet_name: str, + auto_upgrade_profile_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + auto_upgrade_profile_name=auto_upgrade_profile_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = 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["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + fleet_name: str, + auto_upgrade_profile_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a AutoUpgradeProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. + :type auto_upgrade_profile_name: str + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + auto_upgrade_profile_name=auto_upgrade_profile_name, + if_match=if_match, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleet_members_operations.py index 5d9adc5a9494..f9f9bf1a0674 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleet_members_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleet_members_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -43,7 +42,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +88,7 @@ def list_by_fleet( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +168,7 @@ async def get( :rtype: ~azure.mgmt.containerservicefleet.models.FleetMember :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -223,7 +222,7 @@ async def _create_initial( if_none_match: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -467,7 +466,7 @@ async def _update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -697,7 +696,7 @@ async def _delete_initial( if_match: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleet_update_strategies_operations.py index 3424d6929782..1a1a120dd52a 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleet_update_strategies_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleet_update_strategies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -42,7 +41,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -88,7 +87,7 @@ def list_by_fleet( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetUpdateStrategyListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,7 +167,7 @@ async def get( :rtype: ~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +221,7 @@ async def _create_or_update_initial( if_none_match: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -465,7 +464,7 @@ async def _delete_initial( if_match: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleets_operations.py index 2e47da8c13da..c2798a16cf34 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleets_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleets_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -45,7 +44,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +82,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,7 +160,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -236,7 +235,7 @@ async def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> :rtype: ~azure.mgmt.containerservicefleet.models.Fleet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,7 +287,7 @@ async def _create_or_update_initial( if_none_match: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -514,7 +513,7 @@ async def _update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -722,7 +721,7 @@ def get_long_running_output(pipeline_response): async def _delete_initial( self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -852,7 +851,7 @@ async def list_credentials( :rtype: ~azure.mgmt.containerservicefleet.models.FleetCredentialResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_operations.py index 8cb105f2dec3..be50e071ac7c 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_update_runs_operations.py index c7aa6da1c8ba..b430d1bd0e71 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_update_runs_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_update_runs_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -45,7 +45,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,7 +91,7 @@ def list_by_fleet( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UpdateRunListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +171,7 @@ async def get( :rtype: ~azure.mgmt.containerservicefleet.models.UpdateRun :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -225,7 +225,7 @@ async def _create_or_update_initial( if_none_match: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -465,7 +465,7 @@ async def _delete_initial( if_match: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -598,7 +598,7 @@ async def _skip_initial( if_match: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -824,7 +824,7 @@ async def _start_initial( if_match: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -961,7 +961,7 @@ async def _stop_initial( if_match: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/__init__.py index 3d046c826956..43fe15d39c7a 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/__init__.py @@ -5,70 +5,90 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import APIServerAccessProfile -from ._models_py3 import AgentProfile -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import Fleet -from ._models_py3 import FleetCredentialResult -from ._models_py3 import FleetCredentialResults -from ._models_py3 import FleetHubProfile -from ._models_py3 import FleetListResult -from ._models_py3 import FleetMember -from ._models_py3 import FleetMemberListResult -from ._models_py3 import FleetMemberUpdate -from ._models_py3 import FleetPatch -from ._models_py3 import FleetUpdateStrategy -from ._models_py3 import FleetUpdateStrategyListResult -from ._models_py3 import ManagedClusterUpdate -from ._models_py3 import ManagedClusterUpgradeSpec -from ._models_py3 import ManagedServiceIdentity -from ._models_py3 import MemberUpdateStatus -from ._models_py3 import NodeImageSelection -from ._models_py3 import NodeImageSelectionStatus -from ._models_py3 import NodeImageVersion -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import ProxyResource -from ._models_py3 import Resource -from ._models_py3 import SkipProperties -from ._models_py3 import SkipTarget -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateGroup -from ._models_py3 import UpdateGroupStatus -from ._models_py3 import UpdateRun -from ._models_py3 import UpdateRunListResult -from ._models_py3 import UpdateRunStatus -from ._models_py3 import UpdateRunStrategy -from ._models_py3 import UpdateStage -from ._models_py3 import UpdateStageStatus -from ._models_py3 import UpdateStatus -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import WaitStatus +from typing import TYPE_CHECKING -from ._container_service_fleet_mgmt_client_enums import ActionType -from ._container_service_fleet_mgmt_client_enums import CreatedByType -from ._container_service_fleet_mgmt_client_enums import FleetMemberProvisioningState -from ._container_service_fleet_mgmt_client_enums import FleetProvisioningState -from ._container_service_fleet_mgmt_client_enums import FleetUpdateStrategyProvisioningState -from ._container_service_fleet_mgmt_client_enums import ManagedClusterUpgradeType -from ._container_service_fleet_mgmt_client_enums import ManagedServiceIdentityType -from ._container_service_fleet_mgmt_client_enums import NodeImageSelectionType -from ._container_service_fleet_mgmt_client_enums import Origin -from ._container_service_fleet_mgmt_client_enums import TargetType -from ._container_service_fleet_mgmt_client_enums import UpdateRunProvisioningState -from ._container_service_fleet_mgmt_client_enums import UpdateState +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + APIServerAccessProfile, + AgentProfile, + AutoUpgradeNodeImageSelection, + AutoUpgradeProfile, + AutoUpgradeProfileListResult, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + Fleet, + FleetCredentialResult, + FleetCredentialResults, + FleetHubProfile, + FleetListResult, + FleetMember, + FleetMemberListResult, + FleetMemberUpdate, + FleetPatch, + FleetUpdateStrategy, + FleetUpdateStrategyListResult, + ManagedClusterUpdate, + ManagedClusterUpgradeSpec, + ManagedServiceIdentity, + MemberUpdateStatus, + NodeImageSelection, + NodeImageSelectionStatus, + NodeImageVersion, + Operation, + OperationDisplay, + OperationListResult, + ProxyResource, + Resource, + SkipProperties, + SkipTarget, + SystemData, + TrackedResource, + UpdateGroup, + UpdateGroupStatus, + UpdateRun, + UpdateRunListResult, + UpdateRunStatus, + UpdateRunStrategy, + UpdateStage, + UpdateStageStatus, + UpdateStatus, + UserAssignedIdentity, + WaitStatus, +) + +from ._container_service_fleet_mgmt_client_enums import ( # type: ignore + ActionType, + AutoUpgradeNodeImageSelectionType, + AutoUpgradeProfileProvisioningState, + CreatedByType, + FleetMemberProvisioningState, + FleetProvisioningState, + FleetUpdateStrategyProvisioningState, + ManagedClusterUpgradeType, + ManagedServiceIdentityType, + NodeImageSelectionType, + Origin, + TargetType, + UpdateRunProvisioningState, + UpdateState, + UpgradeChannel, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "APIServerAccessProfile", "AgentProfile", + "AutoUpgradeNodeImageSelection", + "AutoUpgradeProfile", + "AutoUpgradeProfileListResult", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", @@ -111,6 +131,8 @@ "UserAssignedIdentity", "WaitStatus", "ActionType", + "AutoUpgradeNodeImageSelectionType", + "AutoUpgradeProfileProvisioningState", "CreatedByType", "FleetMemberProvisioningState", "FleetProvisioningState", @@ -122,6 +144,7 @@ "TargetType", "UpdateRunProvisioningState", "UpdateState", + "UpgradeChannel", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_container_service_fleet_mgmt_client_enums.py index 19e28171fd83..236083df8e74 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_container_service_fleet_mgmt_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_container_service_fleet_mgmt_client_enums.py @@ -16,6 +16,35 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): INTERNAL = "Internal" +class AutoUpgradeNodeImageSelectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The node image upgrade type.""" + + LATEST = "Latest" + """Use the latest image version when upgrading nodes. Clusters may use different image versions + (e.g., 'AKSUbuntu-1804gen2containerd-2021.10.12' and 'AKSUbuntu-1804gen2containerd-2021.10.19') + because, for example, the latest available version is different in different regions.""" + CONSISTENT = "Consistent" + """The image versions to upgrade nodes to are selected as described below: for each node pool in + managed clusters affected by the update run, the system selects the latest image version such + that it is available across all other node pools (in all other clusters) of the same image + type. As a result, all node pools of the same image type will be upgraded to the same image + version. For example, if the latest image version for image type 'AKSUbuntu-1804gen2containerd' + is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is + 'AKSUbuntu-1804gen2containerd-2021.10.17' for a node pool in cluster B in region Y, the system + will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'.""" + + +class AutoUpgradeProfileProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the AutoUpgradeProfile resource.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource.""" @@ -112,6 +141,10 @@ class NodeImageSelectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is 'AKSUbuntu-1804gen2containerd-2021.10.17' for a node pool in cluster B in region Y, the system will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'.""" + CUSTOM = "Custom" + """Upgrade the nodes to the custom image versions. When set, update run will use node image + versions provided in customNodeImageVersions to upgrade the nodes. If set, + customNodeImageVersions must not be empty.""" class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -165,3 +198,18 @@ class UpdateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has failed.""" COMPLETED = "Completed" """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has completed.""" + + +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Configuration of how auto upgrade will be run.""" + + STABLE = "Stable" + """Upgrades the clusters kubernetes version to the latest supported patch release on minor version + N-1, where N is the latest supported minor version. + For example, if a cluster runs version 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 + are available, the cluster upgrades to 1.18.6.""" + RAPID = "Rapid" + """Upgrades the clusters kubernetes version to the latest supported patch release on the latest + supported minor version.""" + NODE_IMAGE = "NodeImage" + """Upgrade node image version of the clusters.""" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_models_py3.py index ce067530b79f..952e9f548598 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # 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. @@ -13,7 +13,6 @@ from .. import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -50,19 +49,271 @@ class APIServerAccessProfile(_serialization.Model): :ivar enable_private_cluster: Whether to create the Fleet hub as a private cluster or not. :vartype enable_private_cluster: bool + :ivar enable_vnet_integration: Whether to enable apiserver vnet integration for the Fleet hub + or not. + :vartype enable_vnet_integration: bool + :ivar subnet_id: The subnet to be used when apiserver vnet integration is enabled. It is + required when creating a new Fleet with BYO vnet. + :vartype subnet_id: str """ _attribute_map = { "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, + "enable_vnet_integration": {"key": "enableVnetIntegration", "type": "bool"}, + "subnet_id": {"key": "subnetId", "type": "str"}, } - def __init__(self, *, enable_private_cluster: Optional[bool] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + enable_private_cluster: Optional[bool] = None, + enable_vnet_integration: Optional[bool] = None, + subnet_id: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword enable_private_cluster: Whether to create the Fleet hub as a private cluster or not. :paramtype enable_private_cluster: bool + :keyword enable_vnet_integration: Whether to enable apiserver vnet integration for the Fleet + hub or not. + :paramtype enable_vnet_integration: bool + :keyword subnet_id: The subnet to be used when apiserver vnet integration is enabled. It is + required when creating a new Fleet with BYO vnet. + :paramtype subnet_id: str """ super().__init__(**kwargs) self.enable_private_cluster = enable_private_cluster + self.enable_vnet_integration = enable_vnet_integration + self.subnet_id = subnet_id + + +class AutoUpgradeNodeImageSelection(_serialization.Model): + """The node image upgrade to be applied to the target clusters in auto upgrade. + + All required parameters must be populated in order to send to server. + + :ivar type: The node image upgrade type. Required. Known values are: "Latest" and "Consistent". + :vartype type: str or + ~azure.mgmt.containerservicefleet.models.AutoUpgradeNodeImageSelectionType + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: Union[str, "_models.AutoUpgradeNodeImageSelectionType"], **kwargs: Any) -> None: + """ + :keyword type: The node image upgrade type. Required. Known values are: "Latest" and + "Consistent". + :paramtype type: str or + ~azure.mgmt.containerservicefleet.models.AutoUpgradeNodeImageSelectionType + """ + super().__init__(**kwargs) + self.type = type + + +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 id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservicefleet.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservicefleet.models.SystemData + """ + + +class AutoUpgradeProfile(ProxyResource): + """The AutoUpgradeProfile resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservicefleet.models.SystemData + :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per + the normal etag convention. Entity tags are used for comparing two or more entities from the + same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match + (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + :vartype e_tag: str + :ivar provisioning_state: The provisioning state of the AutoUpgradeProfile resource. Known + values are: "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerservicefleet.models.AutoUpgradeProfileProvisioningState + :ivar update_strategy_id: The resource id of the UpdateStrategy resource to reference. If not + specified, the auto upgrade will run on all clusters which are members of the fleet. + :vartype update_strategy_id: str + :ivar channel: Configures how auto-upgrade will be run. Known values are: "Stable", "Rapid", + and "NodeImage". + :vartype channel: str or ~azure.mgmt.containerservicefleet.models.UpgradeChannel + :ivar node_image_selection: The node image upgrade to be applied to the target clusters in auto + upgrade. + :vartype node_image_selection: + ~azure.mgmt.containerservicefleet.models.AutoUpgradeNodeImageSelection + :ivar disabled: If set to False: the auto upgrade has effect - target managed clusters will be + upgraded on schedule. + If set to True: the auto upgrade has no effect - no upgrade will be run on the target managed + clusters. + This is a boolean and not an enum because enabled/disabled are all available states of the + auto upgrade profile. + By default, this is set to False. + :vartype disabled: bool + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "e_tag": {"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"}, + "e_tag": {"key": "eTag", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "update_strategy_id": {"key": "properties.updateStrategyId", "type": "str"}, + "channel": {"key": "properties.channel", "type": "str"}, + "node_image_selection": {"key": "properties.nodeImageSelection", "type": "AutoUpgradeNodeImageSelection"}, + "disabled": {"key": "properties.disabled", "type": "bool"}, + } + + def __init__( + self, + *, + update_strategy_id: Optional[str] = None, + channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, + node_image_selection: Optional["_models.AutoUpgradeNodeImageSelection"] = None, + disabled: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword update_strategy_id: The resource id of the UpdateStrategy resource to reference. If + not specified, the auto upgrade will run on all clusters which are members of the fleet. + :paramtype update_strategy_id: str + :keyword channel: Configures how auto-upgrade will be run. Known values are: "Stable", "Rapid", + and "NodeImage". + :paramtype channel: str or ~azure.mgmt.containerservicefleet.models.UpgradeChannel + :keyword node_image_selection: The node image upgrade to be applied to the target clusters in + auto upgrade. + :paramtype node_image_selection: + ~azure.mgmt.containerservicefleet.models.AutoUpgradeNodeImageSelection + :keyword disabled: If set to False: the auto upgrade has effect - target managed clusters will + be upgraded on schedule. + If set to True: the auto upgrade has no effect - no upgrade will be run on the target managed + clusters. + This is a boolean and not an enum because enabled/disabled are all available states of the + auto upgrade profile. + By default, this is set to False. + :paramtype disabled: bool + """ + super().__init__(**kwargs) + self.e_tag = None + self.provisioning_state = None + self.update_strategy_id = update_strategy_id + self.channel = channel + self.node_image_selection = node_image_selection + self.disabled = disabled + + +class AutoUpgradeProfileListResult(_serialization.Model): + """The response of a AutoUpgradeProfile list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The AutoUpgradeProfile items on this page. Required. + :vartype value: list[~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AutoUpgradeProfile]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.AutoUpgradeProfile"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The AutoUpgradeProfile items on this page. Required. + :paramtype value: list[~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link class ErrorAdditionalInfo(_serialization.Model): @@ -157,47 +408,6 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A self.error = error -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 id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - class TrackedResource(Resource): """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. @@ -487,26 +697,6 @@ def __init__(self, *, value: List["_models.Fleet"], next_link: Optional[str] = N self.next_link = next_link -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: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.models.SystemData - """ - - class FleetMember(ProxyResource): """A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. @@ -952,8 +1142,17 @@ class NodeImageSelection(_serialization.Model): All required parameters must be populated in order to send to server. - :ivar type: The node image upgrade type. Required. Known values are: "Latest" and "Consistent". + :ivar type: The node image upgrade type. Required. Known values are: "Latest", "Consistent", + and "Custom". :vartype type: str or ~azure.mgmt.containerservicefleet.models.NodeImageSelectionType + :ivar custom_node_image_versions: Custom node image versions to upgrade the nodes to. This + field is required if node image selection type is Custom. Otherwise, it must be empty. For each + node image family (e.g., 'AKSUbuntu-1804gen2containerd'), this field can contain at most one + version (e.g., only one of 'AKSUbuntu-1804gen2containerd-2023.01.12' or + 'AKSUbuntu-1804gen2containerd-2023.02.12', not both). If the nodes belong to a family without a + matching image version in this field, they are not upgraded. + :vartype custom_node_image_versions: + list[~azure.mgmt.containerservicefleet.models.NodeImageVersion] """ _validation = { @@ -962,16 +1161,32 @@ class NodeImageSelection(_serialization.Model): _attribute_map = { "type": {"key": "type", "type": "str"}, + "custom_node_image_versions": {"key": "customNodeImageVersions", "type": "[NodeImageVersion]"}, } - def __init__(self, *, type: Union[str, "_models.NodeImageSelectionType"], **kwargs: Any) -> None: + def __init__( + self, + *, + type: Union[str, "_models.NodeImageSelectionType"], + custom_node_image_versions: Optional[List["_models.NodeImageVersion"]] = None, + **kwargs: Any + ) -> None: """ - :keyword type: The node image upgrade type. Required. Known values are: "Latest" and - "Consistent". + :keyword type: The node image upgrade type. Required. Known values are: "Latest", "Consistent", + and "Custom". :paramtype type: str or ~azure.mgmt.containerservicefleet.models.NodeImageSelectionType + :keyword custom_node_image_versions: Custom node image versions to upgrade the nodes to. This + field is required if node image selection type is Custom. Otherwise, it must be empty. For each + node image family (e.g., 'AKSUbuntu-1804gen2containerd'), this field can contain at most one + version (e.g., only one of 'AKSUbuntu-1804gen2containerd-2023.01.12' or + 'AKSUbuntu-1804gen2containerd-2023.02.12', not both). If the nodes belong to a family without a + matching image version in this field, they are not upgraded. + :paramtype custom_node_image_versions: + list[~azure.mgmt.containerservicefleet.models.NodeImageVersion] """ super().__init__(**kwargs) self.type = type + self.custom_node_image_versions = custom_node_image_versions class NodeImageSelectionStatus(_serialization.Model): diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/__init__.py index 2233c34e005a..9cc523c738ae 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/__init__.py @@ -5,23 +5,31 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations -from ._update_runs_operations import UpdateRunsOperations -from ._fleet_update_strategies_operations import FleetUpdateStrategiesOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._fleets_operations import FleetsOperations # type: ignore +from ._auto_upgrade_profiles_operations import AutoUpgradeProfilesOperations # type: ignore +from ._fleet_members_operations import FleetMembersOperations # type: ignore +from ._update_runs_operations import UpdateRunsOperations # type: ignore +from ._fleet_update_strategies_operations import FleetUpdateStrategiesOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "Operations", "FleetsOperations", + "AutoUpgradeProfilesOperations", "FleetMembersOperations", "UpdateRunsOperations", "FleetUpdateStrategiesOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_auto_upgrade_profiles_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_auto_upgrade_profiles_operations.py new file mode 100644 index 000000000000..3e2a913084e7 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_auto_upgrade_profiles_operations.py @@ -0,0 +1,774 @@ +# 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 +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +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_fleet_request( + resource_group_name: str, fleet_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", "2025-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, fleet_name: str, auto_upgrade_profile_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "autoUpgradeProfileName": _SERIALIZER.url( + "auto_upgrade_profile_name", + auto_upgrade_profile_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + fleet_name: str, + auto_upgrade_profile_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-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.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "autoUpgradeProfileName": _SERIALIZER.url( + "auto_upgrade_profile_name", + auto_upgrade_profile_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + if if_none_match is not None: + _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") + 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, + fleet_name: str, + auto_upgrade_profile_name: str, + subscription_id: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "fleetName": _SERIALIZER.url( + "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" + ), + "autoUpgradeProfileName": _SERIALIZER.url( + "auto_upgrade_profile_name", + auto_upgrade_profile_name, + "str", + max_length=50, + min_length=1, + pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class AutoUpgradeProfilesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservicefleet.ContainerServiceFleetMgmtClient`'s + :attr:`auto_upgrade_profiles` 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_fleet( + self, resource_group_name: str, fleet_name: str, **kwargs: Any + ) -> Iterable["_models.AutoUpgradeProfile"]: + """List AutoUpgradeProfile resources by Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :return: An iterator like instance of either AutoUpgradeProfile or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile] + :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.AutoUpgradeProfileListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_fleet_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AutoUpgradeProfileListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, fleet_name: str, auto_upgrade_profile_name: str, **kwargs: Any + ) -> _models.AutoUpgradeProfile: + """Get a AutoUpgradeProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. + :type auto_upgrade_profile_name: str + :return: AutoUpgradeProfile or the result of cls(response) + :rtype: ~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = 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.AutoUpgradeProfile] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + auto_upgrade_profile_name=auto_upgrade_profile_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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("AutoUpgradeProfile", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + fleet_name: str, + auto_upgrade_profile_name: str, + resource: Union[_models.AutoUpgradeProfile, IO[bytes]], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "AutoUpgradeProfile") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + auto_upgrade_profile_name=auto_upgrade_profile_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + auto_upgrade_profile_name: str, + resource: _models.AutoUpgradeProfile, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutoUpgradeProfile]: + """Create a AutoUpgradeProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. + :type auto_upgrade_profile_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AutoUpgradeProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + auto_upgrade_profile_name: str, + resource: IO[bytes], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AutoUpgradeProfile]: + """Create a AutoUpgradeProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. + :type auto_upgrade_profile_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AutoUpgradeProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + auto_upgrade_profile_name: str, + resource: Union[_models.AutoUpgradeProfile, IO[bytes]], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.AutoUpgradeProfile]: + """Create a AutoUpgradeProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. + :type auto_upgrade_profile_name: str + :param resource: Resource create parameters. Is either a AutoUpgradeProfile type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile or IO[bytes] + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :param if_none_match: The request should only proceed if no entity matches this string. Default + value is None. + :type if_none_match: str + :return: An instance of LROPoller that returns either AutoUpgradeProfile or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile] + :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.AutoUpgradeProfile] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + auto_upgrade_profile_name=auto_upgrade_profile_name, + resource=resource, + if_match=if_match, + if_none_match=if_none_match, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AutoUpgradeProfile", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.AutoUpgradeProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AutoUpgradeProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + fleet_name: str, + auto_upgrade_profile_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + auto_upgrade_profile_name=auto_upgrade_profile_name, + subscription_id=self._config.subscription_id, + if_match=if_match, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = 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["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + fleet_name: str, + auto_upgrade_profile_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a AutoUpgradeProfile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. Required. + :type fleet_name: str + :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. + :type auto_upgrade_profile_name: str + :param if_match: The request should only proceed if an entity matches this string. Default + value is None. + :type if_match: str + :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( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + auto_upgrade_profile_name=auto_upgrade_profile_name, + if_match=if_match, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleet_members_operations.py index 01c83aacc658..744cd289eed3 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleet_members_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleet_members_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +50,7 @@ def build_list_by_fleet_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +135,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -191,7 +191,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -245,7 +245,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -324,7 +324,7 @@ def list_by_fleet( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -404,7 +404,7 @@ def get( :rtype: ~azure.mgmt.containerservicefleet.models.FleetMember :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -458,7 +458,7 @@ def _create_initial( if_none_match: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -698,7 +698,7 @@ def _update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -924,7 +924,7 @@ def _delete_initial( if_match: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleet_update_strategies_operations.py index 34f0ccfe0637..13fb2e891baf 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleet_update_strategies_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleet_update_strategies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +35,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +49,7 @@ def build_list_by_fleet_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +134,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -191,7 +190,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -271,7 +270,7 @@ def list_by_fleet( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetUpdateStrategyListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -351,7 +350,7 @@ def get( :rtype: ~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -405,7 +404,7 @@ def _create_or_update_initial( if_none_match: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -647,7 +646,7 @@ def _delete_initial( if_match: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleets_operations.py index abd62a23cefd..2d9891404f2d 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleets_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleets_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +48,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +102,7 @@ def build_get_request(resource_group_name: str, fleet_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +143,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -185,7 +185,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -225,7 +225,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -262,7 +262,7 @@ def build_list_credentials_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -324,7 +324,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Fleet"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -402,7 +402,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -477,7 +477,7 @@ def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _mode :rtype: ~azure.mgmt.containerservicefleet.models.Fleet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -529,7 +529,7 @@ def _create_or_update_initial( if_none_match: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -754,7 +754,7 @@ def _update_initial( if_match: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -961,7 +961,7 @@ def get_long_running_output(pipeline_response): def _delete_initial( self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1091,7 +1091,7 @@ def list_credentials( :rtype: ~azure.mgmt.containerservicefleet.models.FleetCredentialResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_operations.py index 7e8d020df652..34b11ff52d87 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +42,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +90,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_update_runs_operations.py index 32aeac64b414..860881871108 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_update_runs_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_update_runs_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +50,7 @@ def build_list_by_fleet_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +135,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -191,7 +191,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -242,7 +242,7 @@ def build_skip_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -296,7 +296,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -347,7 +347,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -424,7 +424,7 @@ def list_by_fleet(self, resource_group_name: str, fleet_name: str, **kwargs: Any api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UpdateRunListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -502,7 +502,7 @@ def get(self, resource_group_name: str, fleet_name: str, update_run_name: str, * :rtype: ~azure.mgmt.containerservicefleet.models.UpdateRun :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -556,7 +556,7 @@ def _create_or_update_initial( if_none_match: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -792,7 +792,7 @@ def _delete_initial( if_match: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -925,7 +925,7 @@ def _skip_initial( if_match: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1148,7 +1148,7 @@ def _start_initial( if_match: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1284,7 +1284,7 @@ def _stop_initial( if_match: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_create_or_update.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_create_or_update.py new file mode 100644 index 000000000000..9fa87236eb16 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_create_or_update.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.containerservicefleet import ContainerServiceFleetMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerservicefleet +# USAGE + python auto_upgrade_profiles_create_or_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 = ContainerServiceFleetMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.auto_upgrade_profiles.begin_create_or_update( + resource_group_name="rg1", + fleet_name="fleet1", + auto_upgrade_profile_name="autoupgradeprofile1", + resource={"properties": {"channel": "Stable"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/AutoUpgradeProfiles_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_delete.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_delete.py new file mode 100644 index 000000000000..c7319adb9fe2 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_delete.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.containerservicefleet import ContainerServiceFleetMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerservicefleet +# USAGE + python auto_upgrade_profiles_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 = ContainerServiceFleetMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="subid1", + ) + + client.auto_upgrade_profiles.begin_delete( + resource_group_name="rg1", + fleet_name="fleet1", + auto_upgrade_profile_name="autoupgradeprofile1", + ).result() + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/AutoUpgradeProfiles_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_get.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_get.py new file mode 100644 index 000000000000..b002729efd39 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_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.containerservicefleet import ContainerServiceFleetMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerservicefleet +# USAGE + python auto_upgrade_profiles_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 = ContainerServiceFleetMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.auto_upgrade_profiles.get( + resource_group_name="rg1", + fleet_name="fleet1", + auto_upgrade_profile_name="autoupgradeprofile1", + ) + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/AutoUpgradeProfiles_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_list_by_fleet.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_list_by_fleet.py new file mode 100644 index 000000000000..5f2a8e67605f --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_list_by_fleet.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.containerservicefleet import ContainerServiceFleetMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerservicefleet +# USAGE + python auto_upgrade_profiles_list_by_fleet.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 = ContainerServiceFleetMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.auto_upgrade_profiles.list_by_fleet( + resource_group_name="rg1", + fleet_name="fleet1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/AutoUpgradeProfiles_ListByFleet.json +if __name__ == "__main__": + main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_create.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_create.py index e01ff0a80028..86d287d0b0fd 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_create.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_create.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/FleetMembers_Create.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/FleetMembers_Create.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_delete.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_delete.py index ff5d5d29be54..1875b9a912a4 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_delete.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/FleetMembers_Delete.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/FleetMembers_Delete.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_get.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_get.py index a974016a6345..7f0e11a72a4a 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_get.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/FleetMembers_Get.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/FleetMembers_Get.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_list_by_fleet.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_list_by_fleet.py index 8d99393c4930..a6adf1d213a4 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_list_by_fleet.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_list_by_fleet.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/FleetMembers_ListByFleet.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/FleetMembers_ListByFleet.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_update.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_update.py index ac69493d8fb4..6a78d6f92297 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_update.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_update.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/FleetMembers_Update.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/FleetMembers_Update.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_create_or_update.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_create_or_update.py index 71ad37cb56fc..6fd9a331961c 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_create_or_update.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_create_or_update.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_CreateOrUpdate.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Fleets_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_delete.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_delete.py index ca250fff5a97..40fe7ec07185 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_delete.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_Delete.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Fleets_Delete.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_get.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_get.py index ce49d372dd15..53254b5415e4 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_get.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_Get.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Fleets_Get.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_resource_group.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_resource_group.py index 28d1514bd937..aea313c02412 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_resource_group.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_ListByResourceGroup.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Fleets_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_sub.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_sub.py index c0237622f1ac..9908749666cd 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_sub.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_sub.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_ListBySub.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Fleets_ListBySub.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_credentials_result.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_credentials_result.py index a38208ef550f..5abb376bd003 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_credentials_result.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_credentials_result.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_ListCredentialsResult.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Fleets_ListCredentialsResult.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_patch_tags.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_patch_tags.py index 4735736dfffd..9c95b771fbaf 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_patch_tags.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_patch_tags.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_PatchTags.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Fleets_PatchTags.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/operations_list.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/operations_list.py index 39ab93738503..926bcc3fa3bb 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/operations_list.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/operations_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Operations_List.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_create_or_update.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_create_or_update.py index f5b8c6e99a20..7b286ce84093 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_create_or_update.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_create_or_update.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_CreateOrUpdate.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateRuns_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_delete.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_delete.py index 9bad600ea0d6..afed5d33120e 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_delete.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_Delete.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateRuns_Delete.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_get.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_get.py index ceb1cb0a3406..01ed0d49f7f9 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_get.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_Get.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateRuns_Get.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_list_by_fleet.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_list_by_fleet.py index 7b6b48ddb874..622b9d86659a 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_list_by_fleet.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_list_by_fleet.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_ListByFleet.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateRuns_ListByFleet.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_skip.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_skip.py index 8d616f44dd87..97a87766ee41 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_skip.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_skip.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_Skip.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateRuns_Skip.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_start.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_start.py index 488ea88e8c9e..681d1b0fb5c2 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_start.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_start.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_Start.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateRuns_Start.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_stop.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_stop.py index 406608f22b6f..9c1fc1cb2edc 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_stop.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_stop.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_Stop.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateRuns_Stop.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_create_or_update.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_create_or_update.py index 62f78fefc36e..c0e43ea6113c 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_create_or_update.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_create_or_update.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateStrategies_CreateOrUpdate.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateStrategies_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_delete.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_delete.py index f8e45c552f7c..61c069aa8a8f 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_delete.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateStrategies_Delete.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateStrategies_Delete.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_get.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_get.py index ca1eb995a791..7302269ae365 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_get.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateStrategies_Get.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateStrategies_Get.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_list_by_fleet.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_list_by_fleet.py index a1fdcf48fa45..ddc610df219a 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_list_by_fleet.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_list_by_fleet.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateStrategies_ListByFleet.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateStrategies_ListByFleet.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/conftest.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/conftest.py index bbd33d7d1d2e..352d63ebc54d 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/conftest.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/conftest.py @@ -18,7 +18,7 @@ load_dotenv() -# aovid record sensitive identity information in recordings +# For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): containerservicefleetmgmt_subscription_id = os.environ.get( diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_auto_upgrade_profiles_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_auto_upgrade_profiles_operations.py index c866c555cdcf..9e2fbc30a3ee 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_auto_upgrade_profiles_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_auto_upgrade_profiles_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_fleet(self, resource_group): + def test_auto_upgrade_profiles_list_by_fleet(self, resource_group): response = self.client.auto_upgrade_profiles.list_by_fleet( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-05-02-preview", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list_by_fleet(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_auto_upgrade_profiles_get(self, resource_group): response = self.client.auto_upgrade_profiles.get( resource_group_name=resource_group.name, fleet_name="str", auto_upgrade_profile_name="str", - api_version="2024-05-02-preview", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_auto_upgrade_profiles_begin_create_or_update(self, resource_group): response = self.client.auto_upgrade_profiles.begin_create_or_update( resource_group_name=resource_group.name, fleet_name="str", @@ -69,7 +69,7 @@ def test_begin_create_or_update(self, resource_group): "type": "str", "updateStrategyId": "str", }, - api_version="2024-05-02-preview", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -77,12 +77,12 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_auto_upgrade_profiles_begin_delete(self, resource_group): response = self.client.auto_upgrade_profiles.begin_delete( resource_group_name=resource_group.name, fleet_name="str", auto_upgrade_profile_name="str", - api_version="2024-05-02-preview", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_auto_upgrade_profiles_operations_async.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_auto_upgrade_profiles_operations_async.py index 7c1e16f8f52d..1781f1d44ffc 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_auto_upgrade_profiles_operations_async.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_auto_upgrade_profiles_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_fleet(self, resource_group): + async def test_auto_upgrade_profiles_list_by_fleet(self, resource_group): response = self.client.auto_upgrade_profiles.list_by_fleet( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-05-02-preview", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list_by_fleet(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_auto_upgrade_profiles_get(self, resource_group): response = await self.client.auto_upgrade_profiles.get( resource_group_name=resource_group.name, fleet_name="str", auto_upgrade_profile_name="str", - api_version="2024-05-02-preview", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_auto_upgrade_profiles_begin_create_or_update(self, resource_group): response = await ( await self.client.auto_upgrade_profiles.begin_create_or_update( resource_group_name=resource_group.name, @@ -71,7 +71,7 @@ async def test_begin_create_or_update(self, resource_group): "type": "str", "updateStrategyId": "str", }, - api_version="2024-05-02-preview", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -80,13 +80,13 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_auto_upgrade_profiles_begin_delete(self, resource_group): response = await ( await self.client.auto_upgrade_profiles.begin_delete( resource_group_name=resource_group.name, fleet_name="str", auto_upgrade_profile_name="str", - api_version="2024-05-02-preview", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_members_operations.py index 269317f431fe..1e36ccd0ccbb 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_members_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_members_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_fleet(self, resource_group): + def test_fleet_members_list_by_fleet(self, resource_group): response = self.client.fleet_members.list_by_fleet( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list_by_fleet(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_fleet_members_get(self, resource_group): response = self.client.fleet_members.get( resource_group_name=resource_group.name, fleet_name="str", fleet_member_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create(self, resource_group): + def test_fleet_members_begin_create(self, resource_group): response = self.client.fleet_members.begin_create( resource_group_name=resource_group.name, fleet_name="str", @@ -67,7 +67,7 @@ def test_begin_create(self, resource_group): }, "type": "str", }, - api_version="2024-04-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -75,13 +75,13 @@ def test_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_fleet_members_begin_update(self, resource_group): response = self.client.fleet_members.begin_update( resource_group_name=resource_group.name, fleet_name="str", fleet_member_name="str", properties={"group": "str"}, - api_version="2024-04-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -89,12 +89,12 @@ def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_fleet_members_begin_delete(self, resource_group): response = self.client.fleet_members.begin_delete( resource_group_name=resource_group.name, fleet_name="str", fleet_member_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_members_operations_async.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_members_operations_async.py index 2b47776dac94..e191d659bf5b 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_members_operations_async.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_members_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_fleet(self, resource_group): + async def test_fleet_members_list_by_fleet(self, resource_group): response = self.client.fleet_members.list_by_fleet( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list_by_fleet(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_fleet_members_get(self, resource_group): response = await self.client.fleet_members.get( resource_group_name=resource_group.name, fleet_name="str", fleet_member_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create(self, resource_group): + async def test_fleet_members_begin_create(self, resource_group): response = await ( await self.client.fleet_members.begin_create( resource_group_name=resource_group.name, @@ -69,7 +69,7 @@ async def test_begin_create(self, resource_group): }, "type": "str", }, - api_version="2024-04-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -78,14 +78,14 @@ async def test_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_fleet_members_begin_update(self, resource_group): response = await ( await self.client.fleet_members.begin_update( resource_group_name=resource_group.name, fleet_name="str", fleet_member_name="str", properties={"group": "str"}, - api_version="2024-04-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -94,13 +94,13 @@ async def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_fleet_members_begin_delete(self, resource_group): response = await ( await self.client.fleet_members.begin_delete( resource_group_name=resource_group.name, fleet_name="str", fleet_member_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_update_strategies_operations.py index f5589366e0d9..2dd55bd8a85e 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_update_strategies_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_update_strategies_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_fleet(self, resource_group): + def test_fleet_update_strategies_list_by_fleet(self, resource_group): response = self.client.fleet_update_strategies.list_by_fleet( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list_by_fleet(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_fleet_update_strategies_get(self, resource_group): response = self.client.fleet_update_strategies.get( resource_group_name=resource_group.name, fleet_name="str", update_strategy_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_fleet_update_strategies_begin_create_or_update(self, resource_group): response = self.client.fleet_update_strategies.begin_create_or_update( resource_group_name=resource_group.name, fleet_name="str", @@ -66,7 +66,7 @@ def test_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-04-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -74,12 +74,12 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_fleet_update_strategies_begin_delete(self, resource_group): response = self.client.fleet_update_strategies.begin_delete( resource_group_name=resource_group.name, fleet_name="str", update_strategy_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_update_strategies_operations_async.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_update_strategies_operations_async.py index ce0e92b44bbd..28b7ac150558 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_update_strategies_operations_async.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_update_strategies_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_fleet(self, resource_group): + async def test_fleet_update_strategies_list_by_fleet(self, resource_group): response = self.client.fleet_update_strategies.list_by_fleet( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list_by_fleet(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_fleet_update_strategies_get(self, resource_group): response = await self.client.fleet_update_strategies.get( resource_group_name=resource_group.name, fleet_name="str", update_strategy_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_fleet_update_strategies_begin_create_or_update(self, resource_group): response = await ( await self.client.fleet_update_strategies.begin_create_or_update( resource_group_name=resource_group.name, @@ -70,7 +70,7 @@ async def test_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-04-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -79,13 +79,13 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_fleet_update_strategies_begin_delete(self, resource_group): response = await ( await self.client.fleet_update_strategies.begin_delete( resource_group_name=resource_group.name, fleet_name="str", update_strategy_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleets_operations.py index c81a2a5eb90c..958dbb2d49c1 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleets_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleets_operations.py @@ -20,9 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_subscription(self, resource_group): + def test_fleets_list_by_subscription(self, resource_group): response = self.client.fleets.list_by_subscription( - api_version="2024-04-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -30,10 +30,10 @@ def test_list_by_subscription(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_resource_group(self, resource_group): + def test_fleets_list_by_resource_group(self, resource_group): response = self.client.fleets.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-04-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -41,11 +41,11 @@ def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_fleets_get(self, resource_group): response = self.client.fleets.get( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -53,7 +53,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_fleets_begin_create_or_update(self, resource_group): response = self.client.fleets.begin_create_or_update( resource_group_name=resource_group.name, fleet_name="str", @@ -62,7 +62,11 @@ def test_begin_create_or_update(self, resource_group): "eTag": "str", "hubProfile": { "agentProfile": {"subnetId": "str", "vmSize": "str"}, - "apiServerAccessProfile": {"enablePrivateCluster": bool}, + "apiServerAccessProfile": { + "enablePrivateCluster": bool, + "enableVnetIntegration": bool, + "subnetId": "str", + }, "dnsPrefix": "str", "fqdn": "str", "kubernetesVersion": "str", @@ -88,7 +92,7 @@ def test_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-04-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -96,7 +100,7 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_fleets_begin_update(self, resource_group): response = self.client.fleets.begin_update( resource_group_name=resource_group.name, fleet_name="str", @@ -109,7 +113,7 @@ def test_begin_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2024-04-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -117,11 +121,11 @@ def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_fleets_begin_delete(self, resource_group): response = self.client.fleets.begin_delete( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -129,11 +133,11 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_credentials(self, resource_group): + def test_fleets_list_credentials(self, resource_group): response = self.client.fleets.list_credentials( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleets_operations_async.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleets_operations_async.py index 59d88781040c..ee0bc929fb7a 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleets_operations_async.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleets_operations_async.py @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_subscription(self, resource_group): + async def test_fleets_list_by_subscription(self, resource_group): response = self.client.fleets.list_by_subscription( - api_version="2024-04-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -31,10 +31,10 @@ async def test_list_by_subscription(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_resource_group(self, resource_group): + async def test_fleets_list_by_resource_group(self, resource_group): response = self.client.fleets.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-04-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -42,11 +42,11 @@ async def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_fleets_get(self, resource_group): response = await self.client.fleets.get( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -54,7 +54,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_fleets_begin_create_or_update(self, resource_group): response = await ( await self.client.fleets.begin_create_or_update( resource_group_name=resource_group.name, @@ -64,7 +64,11 @@ async def test_begin_create_or_update(self, resource_group): "eTag": "str", "hubProfile": { "agentProfile": {"subnetId": "str", "vmSize": "str"}, - "apiServerAccessProfile": {"enablePrivateCluster": bool}, + "apiServerAccessProfile": { + "enablePrivateCluster": bool, + "enableVnetIntegration": bool, + "subnetId": "str", + }, "dnsPrefix": "str", "fqdn": "str", "kubernetesVersion": "str", @@ -90,7 +94,7 @@ async def test_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-04-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -99,7 +103,7 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_fleets_begin_update(self, resource_group): response = await ( await self.client.fleets.begin_update( resource_group_name=resource_group.name, @@ -113,7 +117,7 @@ async def test_begin_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2024-04-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -122,12 +126,12 @@ async def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_fleets_begin_delete(self, resource_group): response = await ( await self.client.fleets.begin_delete( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -136,11 +140,11 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_credentials(self, resource_group): + async def test_fleets_list_credentials(self, resource_group): response = await self.client.fleets.list_credentials( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_operations.py index bcbb878f7e2e..6af34ada0832 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_operations.py @@ -20,9 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2024-04-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_operations_async.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_operations_async.py index f302bd933121..89f911442e27 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_operations_async.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_operations_async.py @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2024-04-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_update_runs_operations.py index 27ad083b970f..365d390bfe99 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_update_runs_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_update_runs_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_fleet(self, resource_group): + def test_update_runs_list_by_fleet(self, resource_group): response = self.client.update_runs.list_by_fleet( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list_by_fleet(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_update_runs_get(self, resource_group): response = self.client.update_runs.get( resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_update_runs_begin_create_or_update(self, resource_group): response = self.client.update_runs.begin_create_or_update( resource_group_name=resource_group.name, fleet_name="str", @@ -55,7 +55,7 @@ def test_begin_create_or_update(self, resource_group): "id": "str", "managedClusterUpdate": { "upgrade": {"type": "str", "kubernetesVersion": "str"}, - "nodeImageSelection": {"type": "str"}, + "nodeImageSelection": {"type": "str", "customNodeImageVersions": [{"version": "str"}]}, }, "name": "str", "provisioningState": "str", @@ -155,7 +155,7 @@ def test_begin_create_or_update(self, resource_group): "type": "str", "updateStrategyId": "str", }, - api_version="2024-04-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -163,12 +163,12 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_update_runs_begin_delete(self, resource_group): response = self.client.update_runs.begin_delete( resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -176,13 +176,13 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_skip(self, resource_group): + def test_update_runs_begin_skip(self, resource_group): response = self.client.update_runs.begin_skip( resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", body={"targets": [{"name": "str", "type": "str"}]}, - api_version="2024-04-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -190,12 +190,12 @@ def test_begin_skip(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_start(self, resource_group): + def test_update_runs_begin_start(self, resource_group): response = self.client.update_runs.begin_start( resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -203,12 +203,12 @@ def test_begin_start(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_stop(self, resource_group): + def test_update_runs_begin_stop(self, resource_group): response = self.client.update_runs.begin_stop( resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_update_runs_operations_async.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_update_runs_operations_async.py index 6967ea1a2dcf..a783cfedebef 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_update_runs_operations_async.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_update_runs_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_fleet(self, resource_group): + async def test_update_runs_list_by_fleet(self, resource_group): response = self.client.update_runs.list_by_fleet( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list_by_fleet(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_update_runs_get(self, resource_group): response = await self.client.update_runs.get( resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_update_runs_begin_create_or_update(self, resource_group): response = await ( await self.client.update_runs.begin_create_or_update( resource_group_name=resource_group.name, @@ -57,7 +57,7 @@ async def test_begin_create_or_update(self, resource_group): "id": "str", "managedClusterUpdate": { "upgrade": {"type": "str", "kubernetesVersion": "str"}, - "nodeImageSelection": {"type": "str"}, + "nodeImageSelection": {"type": "str", "customNodeImageVersions": [{"version": "str"}]}, }, "name": "str", "provisioningState": "str", @@ -159,7 +159,7 @@ async def test_begin_create_or_update(self, resource_group): "type": "str", "updateStrategyId": "str", }, - api_version="2024-04-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -168,13 +168,13 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_update_runs_begin_delete(self, resource_group): response = await ( await self.client.update_runs.begin_delete( resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -183,14 +183,14 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_skip(self, resource_group): + async def test_update_runs_begin_skip(self, resource_group): response = await ( await self.client.update_runs.begin_skip( resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", body={"targets": [{"name": "str", "type": "str"}]}, - api_version="2024-04-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -199,13 +199,13 @@ async def test_begin_skip(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_start(self, resource_group): + async def test_update_runs_begin_start(self, resource_group): response = await ( await self.client.update_runs.begin_start( resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -214,13 +214,13 @@ async def test_begin_start(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_stop(self, resource_group): + async def test_update_runs_begin_stop(self, resource_group): response = await ( await self.client.update_runs.begin_stop( resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", - api_version="2024-04-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/setup.py b/sdk/containerservice/azure-mgmt-containerservicefleet/setup.py index d354cdd33896..0d81be0b86c1 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/setup.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/setup.py @@ -22,11 +22,9 @@ # Version extraction inspired from 'requests' with open( - ( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py") - ), + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py"), "r", ) as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)