diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/CHANGELOG.md b/sdk/containerservice/azure-mgmt-containerservicefleet/CHANGELOG.md index df9b57d35c27..5bc6108dfff3 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/CHANGELOG.md +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/CHANGELOG.md @@ -1,5 +1,61 @@ # Release History +## 3.1.0b1 (2025-04-03) + +### Features Added + + - Client `ContainerServiceFleetMgmtClient` added operation group `auto_upgrade_profiles` + - Client `ContainerServiceFleetMgmtClient` added operation group `auto_upgrade_profile_operations` + - Client `ContainerServiceFleetMgmtClient` added operation group `gates` + - Model `APIServerAccessProfile` added property `enable_vnet_integration` + - Model `APIServerAccessProfile` added property `subnet_id` + - Model `Fleet` added property `status` + - Model `FleetMember` added property `labels` + - Model `FleetMember` added property `status` + - Model `FleetMemberUpdate` added property `labels` + - Model `NodeImageSelection` added property `custom_node_image_versions` + - Enum `NodeImageSelectionType` added member `CUSTOM` + - Model `UpdateGroup` added property `before_gates` + - Model `UpdateGroup` added property `after_gates` + - Model `UpdateGroupStatus` added property `before_gates` + - Model `UpdateGroupStatus` added property `after_gates` + - Model `UpdateRun` added property `auto_upgrade_profile_id` + - Model `UpdateStage` added property `before_gates` + - Model `UpdateStage` added property `after_gates` + - Model `UpdateStageStatus` added property `before_gates` + - Model `UpdateStageStatus` added property `after_gates` + - Enum `UpdateState` added member `PENDING` + - Added enum `AutoUpgradeLastTriggerStatus` + - Added model `AutoUpgradeNodeImageSelection` + - Added enum `AutoUpgradeNodeImageSelectionType` + - Added model `AutoUpgradeProfile` + - Added model `AutoUpgradeProfileListResult` + - Added enum `AutoUpgradeProfileProvisioningState` + - Added model `AutoUpgradeProfileStatus` + - Added model `FleetMemberStatus` + - Added model `FleetStatus` + - Added model `Gate` + - Added model `GateConfiguration` + - Added model `GateListResult` + - Added model `GatePatch` + - Added model `GatePatchProperties` + - Added enum `GateProvisioningState` + - Added enum `GateState` + - Added model `GateTarget` + - Added enum `GateType` + - Added model `GenerateResponse` + - Added enum `Timing` + - Added model `UpdateRunGateStatus` + - Added model `UpdateRunGateTargetProperties` + - Added enum `UpgradeChannel` + - Added model `AutoUpgradeProfileOperationsOperations` + - Added model `AutoUpgradeProfilesOperations` + - Added model `GatesOperations` + - Method `AutoUpgradeProfilesOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, fleet_name: str, auto_upgrade_profile_name: str, resource: AutoUpgradeProfile, if_match: Optional[str], if_none_match: Optional[str], content_type: str)` + - Method `AutoUpgradeProfilesOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, fleet_name: str, auto_upgrade_profile_name: str, resource: IO[bytes], if_match: Optional[str], if_none_match: Optional[str], content_type: str)` + - Method `GatesOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, fleet_name: str, gate_name: str, properties: GatePatch, if_match: Optional[str], if_none_match: Optional[str], content_type: str)` + - Method `GatesOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, fleet_name: str, gate_name: str, properties: IO[bytes], if_match: Optional[str], if_none_match: Optional[str], content_type: str)` + ## 3.0.0 (2024-10-31) ### Breaking Changes diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/README.md b/sdk/containerservice/azure-mgmt-containerservicefleet/README.md index 0b60ee1f99e3..789965970989 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/README.md +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/README.md @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/_meta.json b/sdk/containerservice/azure-mgmt-containerservicefleet/_meta.json index 59de5d8da265..339f16b5614d 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/_meta.json +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/_meta.json @@ -1,11 +1,11 @@ { - "commit": "a4fc4c6bda9ff2315671bca69f9de40a43e2bd8c", + "commit": "a8e56c4d984528fdf892bf1b805b859984f6f8f2", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.19.0", + "@autorest/python@6.27.4", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-2024-04 --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.27.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.md" } \ No newline at end of file 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..caf46b2b6054 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 @@ -26,15 +25,15 @@ class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many- :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "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..8913310ded7d 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,25 +19,35 @@ from ._configuration import ContainerServiceFleetMgmtClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + AutoUpgradeProfileOperationsOperations, + AutoUpgradeProfilesOperations, FleetMembersOperations, FleetUpdateStrategiesOperations, FleetsOperations, + GatesOperations, Operations, UpdateRunsOperations, ) 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: # pylint: disable=too-many-instance-attributes """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 auto_upgrade_profile_operations: AutoUpgradeProfileOperationsOperations operations + :vartype auto_upgrade_profile_operations: + azure.mgmt.containerservicefleet.operations.AutoUpgradeProfileOperationsOperations + :ivar gates: GatesOperations operations + :vartype gates: azure.mgmt.containerservicefleet.operations.GatesOperations :ivar fleet_members: FleetMembersOperations operations :vartype fleet_members: azure.mgmt.containerservicefleet.operations.FleetMembersOperations :ivar update_runs: UpdateRunsOperations operations @@ -47,12 +57,12 @@ class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-ver azure.mgmt.containerservicefleet.operations.FleetUpdateStrategiesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "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 +104,13 @@ 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.auto_upgrade_profile_operations = AutoUpgradeProfileOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.gates = GatesOperations(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/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_version.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" 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..e82b27092252 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 @@ -26,15 +25,15 @@ class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many- :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "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..eb06d4b70fc7 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,25 +19,35 @@ from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceFleetMgmtClientConfiguration from .operations import ( + AutoUpgradeProfileOperationsOperations, + AutoUpgradeProfilesOperations, FleetMembersOperations, FleetUpdateStrategiesOperations, FleetsOperations, + GatesOperations, Operations, UpdateRunsOperations, ) 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: # pylint: disable=too-many-instance-attributes """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 auto_upgrade_profile_operations: AutoUpgradeProfileOperationsOperations operations + :vartype auto_upgrade_profile_operations: + azure.mgmt.containerservicefleet.aio.operations.AutoUpgradeProfileOperationsOperations + :ivar gates: GatesOperations operations + :vartype gates: azure.mgmt.containerservicefleet.aio.operations.GatesOperations :ivar fleet_members: FleetMembersOperations operations :vartype fleet_members: azure.mgmt.containerservicefleet.aio.operations.FleetMembersOperations :ivar update_runs: UpdateRunsOperations operations @@ -47,12 +57,12 @@ class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-ver azure.mgmt.containerservicefleet.aio.operations.FleetUpdateStrategiesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "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 +104,13 @@ 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.auto_upgrade_profile_operations = AutoUpgradeProfileOperationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.gates = GatesOperations(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..3c9c3fe0dba8 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,35 @@ # 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 ._auto_upgrade_profile_operations_operations import AutoUpgradeProfileOperationsOperations # type: ignore +from ._gates_operations import GatesOperations # 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", + "AutoUpgradeProfileOperationsOperations", + "GatesOperations", "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_profile_operations_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_auto_upgrade_profile_operations_operations.py new file mode 100644 index 000000000000..5b90ededf383 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_auto_upgrade_profile_operations_operations.py @@ -0,0 +1,184 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast + +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_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_profile_operations_operations import build_generate_update_run_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 AutoUpgradeProfileOperationsOperations: + """ + .. 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_profile_operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _generate_update_run_initial( + self, resource_group_name: str, fleet_name: str, auto_upgrade_profile_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = 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_generate_update_run_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) + + _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, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["If-Match"] = self._deserialize("str", response.headers.get("If-Match")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + 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_generate_update_run( + self, resource_group_name: str, fleet_name: str, auto_upgrade_profile_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.GenerateResponse]: + """A long-running resource action. + + :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: An instance of AsyncLROPoller that returns either GenerateResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.GenerateResponse] + :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.GenerateResponse] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._generate_update_run_initial( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + auto_upgrade_profile_name=auto_upgrade_profile_name, + 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): + deserialized = self._deserialize("GenerateResponse", 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.GenerateResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GenerateResponse]( + 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/_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/_gates_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_gates_operations.py new file mode 100644 index 000000000000..1204cd9643b2 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_gates_operations.py @@ -0,0 +1,441 @@ +# 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._gates_operations import build_get_request, build_list_by_fleet_request, build_update_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 GatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservicefleet.aio.ContainerServiceFleetMgmtClient`'s + :attr:`gates` 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.Gate"]: + """List Gate 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 Gate or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.models.Gate] + :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.GateListResult] = 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("GateListResult", 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, gate_name: str, **kwargs: Any) -> _models.Gate: + """Get a Gate. + + :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 gate_name: The name of the Gate resource, a GUID. Required. + :type gate_name: str + :return: Gate or the result of cls(response) + :rtype: ~azure.mgmt.containerservicefleet.models.Gate + :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.Gate] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + gate_name=gate_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("Gate", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + fleet_name: str, + gate_name: str, + properties: Union[_models.GatePatch, 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(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "GatePatch") + + _request = build_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + gate_name=gate_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, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = 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 + + @overload + async def begin_update( + self, + resource_group_name: str, + fleet_name: str, + gate_name: str, + properties: _models.GatePatch, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Gate]: + """Update a Gate. + + :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 gate_name: The name of the Gate resource, a GUID. Required. + :type gate_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.containerservicefleet.models.GatePatch + :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 Gate or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.Gate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + fleet_name: str, + gate_name: str, + properties: IO[bytes], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Gate]: + """Update a Gate. + + :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 gate_name: The name of the Gate resource, a GUID. Required. + :type gate_name: str + :param properties: The resource properties to be updated. Required. + :type properties: 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 Gate or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.Gate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + fleet_name: str, + gate_name: str, + properties: Union[_models.GatePatch, IO[bytes]], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Gate]: + """Update a Gate. + + :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 gate_name: The name of the Gate resource, a GUID. Required. + :type gate_name: str + :param properties: The resource properties to be updated. Is either a GatePatch type or a + IO[bytes] type. Required. + :type properties: ~azure.mgmt.containerservicefleet.models.GatePatch 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 Gate or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.Gate] + :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.Gate] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + gate_name=gate_name, + properties=properties, + 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("Gate", 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": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Gate].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Gate]( + 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/_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..841132128117 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,108 @@ # 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, + AutoUpgradeProfileStatus, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + Fleet, + FleetCredentialResult, + FleetCredentialResults, + FleetHubProfile, + FleetListResult, + FleetMember, + FleetMemberListResult, + FleetMemberStatus, + FleetMemberUpdate, + FleetPatch, + FleetStatus, + FleetUpdateStrategy, + FleetUpdateStrategyListResult, + Gate, + GateConfiguration, + GateListResult, + GatePatch, + GatePatchProperties, + GateTarget, + GenerateResponse, + ManagedClusterUpdate, + ManagedClusterUpgradeSpec, + ManagedServiceIdentity, + MemberUpdateStatus, + NodeImageSelection, + NodeImageSelectionStatus, + NodeImageVersion, + Operation, + OperationDisplay, + OperationListResult, + ProxyResource, + Resource, + SkipProperties, + SkipTarget, + SystemData, + TrackedResource, + UpdateGroup, + UpdateGroupStatus, + UpdateRun, + UpdateRunGateStatus, + UpdateRunGateTargetProperties, + UpdateRunListResult, + UpdateRunStatus, + UpdateRunStrategy, + UpdateStage, + UpdateStageStatus, + UpdateStatus, + UserAssignedIdentity, + WaitStatus, +) + +from ._container_service_fleet_mgmt_client_enums import ( # type: ignore + ActionType, + AutoUpgradeLastTriggerStatus, + AutoUpgradeNodeImageSelectionType, + AutoUpgradeProfileProvisioningState, + CreatedByType, + FleetMemberProvisioningState, + FleetProvisioningState, + FleetUpdateStrategyProvisioningState, + GateProvisioningState, + GateState, + GateType, + ManagedClusterUpgradeType, + ManagedServiceIdentityType, + NodeImageSelectionType, + Origin, + TargetType, + Timing, + 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", + "AutoUpgradeProfileStatus", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", @@ -79,10 +117,19 @@ "FleetListResult", "FleetMember", "FleetMemberListResult", + "FleetMemberStatus", "FleetMemberUpdate", "FleetPatch", + "FleetStatus", "FleetUpdateStrategy", "FleetUpdateStrategyListResult", + "Gate", + "GateConfiguration", + "GateListResult", + "GatePatch", + "GatePatchProperties", + "GateTarget", + "GenerateResponse", "ManagedClusterUpdate", "ManagedClusterUpgradeSpec", "ManagedServiceIdentity", @@ -102,6 +149,8 @@ "UpdateGroup", "UpdateGroupStatus", "UpdateRun", + "UpdateRunGateStatus", + "UpdateRunGateTargetProperties", "UpdateRunListResult", "UpdateRunStatus", "UpdateRunStrategy", @@ -111,17 +160,25 @@ "UserAssignedIdentity", "WaitStatus", "ActionType", + "AutoUpgradeLastTriggerStatus", + "AutoUpgradeNodeImageSelectionType", + "AutoUpgradeProfileProvisioningState", "CreatedByType", "FleetMemberProvisioningState", "FleetProvisioningState", "FleetUpdateStrategyProvisioningState", + "GateProvisioningState", + "GateState", + "GateType", "ManagedClusterUpgradeType", "ManagedServiceIdentityType", "NodeImageSelectionType", "Origin", "TargetType", + "Timing", "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..dd9c51469b84 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,47 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): INTERNAL = "Internal" +class AutoUpgradeLastTriggerStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """AutoUpgradeLastTriggerStatus is the status of the last AutoUpgrade trigger (attempt to + automatically create and start UpdateRun when there are new released versions) of an auto + upgrade profile. + """ + + SUCCEEDED = "Succeeded" + """The last AutoUpgrade trigger was succeeded.""" + FAILED = "Failed" + """The last AutoUpgrade trigger failed.""" + + +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.""" @@ -70,6 +111,35 @@ class FleetUpdateStrategyProvisioningState(str, Enum, metaclass=CaseInsensitiveE """Resource creation was canceled.""" +class GateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the Gate resource.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + + +class GateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The state of the Gate.""" + + PENDING = "Pending" + """A Pending Gate will continue to block the staged rollout process it is controlling.""" + SKIPPED = "Skipped" + """A Skipped Gate means that the staged rollout process it is controlling was skipped.""" + COMPLETED = "Completed" + """An Completed Gate allows the staged rollout process to continue.""" + + +class GateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the Gate determines how it is completed.""" + + APPROVAL = "Approval" + """An approval gate is completed by setting its state to be Completed.""" + + class ManagedClusterUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of upgrade to perform when targeting ManagedClusters.""" @@ -112,6 +182,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): @@ -137,6 +211,15 @@ class TargetType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Skip the update of the after stage wait of a certain stage.""" +class Timing(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether the Gate is placed before or after the target.""" + + BEFORE = "Before" + """The Gate is before the target.""" + AFTER = "After" + """The Gate is after the target.""" + + class UpdateRunProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the UpdateRun resource.""" @@ -163,5 +246,22 @@ class UpdateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has been skipped.""" FAILED = "Failed" """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has failed.""" + PENDING = "Pending" + """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is pending.""" 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..5fb0b17d7fbf 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,325 @@ 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.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 + :ivar auto_upgrade_profile_status: The status of the auto upgrade profile. + :vartype auto_upgrade_profile_status: + ~azure.mgmt.containerservicefleet.models.AutoUpgradeProfileStatus + """ + + _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"}, + "auto_upgrade_profile_status": { + "key": "properties.autoUpgradeProfileStatus", + "type": "AutoUpgradeProfileStatus", + }, + } + + 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, + auto_upgrade_profile_status: Optional["_models.AutoUpgradeProfileStatus"] = 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 + :keyword auto_upgrade_profile_status: The status of the auto upgrade profile. + :paramtype auto_upgrade_profile_status: + ~azure.mgmt.containerservicefleet.models.AutoUpgradeProfileStatus + """ + 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 + self.auto_upgrade_profile_status = auto_upgrade_profile_status + + +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 AutoUpgradeProfileStatus(_serialization.Model): + """AutoUpgradeProfileStatus is the status of an auto upgrade profile. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar last_triggered_at: The UTC time of the last attempt to automatically create and start an + UpdateRun as triggered by the release of new versions. + :vartype last_triggered_at: ~datetime.datetime + :ivar last_trigger_status: The status of the last AutoUpgrade trigger. Known values are: + "Succeeded" and "Failed". + :vartype last_trigger_status: str or + ~azure.mgmt.containerservicefleet.models.AutoUpgradeLastTriggerStatus + :ivar last_trigger_error: The error details of the last trigger. + :vartype last_trigger_error: ~azure.mgmt.containerservicefleet.models.ErrorDetail + :ivar last_trigger_upgrade_versions: The target Kubernetes version or node image versions of + the last trigger. + :vartype last_trigger_upgrade_versions: list[str] + """ + + _validation = { + "last_triggered_at": {"readonly": True}, + "last_trigger_status": {"readonly": True}, + "last_trigger_error": {"readonly": True}, + "last_trigger_upgrade_versions": {"readonly": True}, + } + + _attribute_map = { + "last_triggered_at": {"key": "lastTriggeredAt", "type": "iso-8601"}, + "last_trigger_status": {"key": "lastTriggerStatus", "type": "str"}, + "last_trigger_error": {"key": "lastTriggerError", "type": "ErrorDetail"}, + "last_trigger_upgrade_versions": {"key": "lastTriggerUpgradeVersions", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.last_triggered_at = None + self.last_trigger_status = None + self.last_trigger_error = None + self.last_trigger_upgrade_versions = None class ErrorAdditionalInfo(_serialization.Model): @@ -157,47 +462,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'. @@ -206,8 +470,8 @@ class TrackedResource(Resource): All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -259,8 +523,8 @@ class Fleet(TrackedResource): All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -287,6 +551,8 @@ class Fleet(TrackedResource): ~azure.mgmt.containerservicefleet.models.FleetProvisioningState :ivar hub_profile: The FleetHubProfile configures the Fleet's hub. :vartype hub_profile: ~azure.mgmt.containerservicefleet.models.FleetHubProfile + :ivar status: Status information for the fleet. + :vartype status: ~azure.mgmt.containerservicefleet.models.FleetStatus """ _validation = { @@ -297,6 +563,7 @@ class Fleet(TrackedResource): "location": {"required": True}, "e_tag": {"readonly": True}, "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, } _attribute_map = { @@ -310,6 +577,7 @@ class Fleet(TrackedResource): "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "hub_profile": {"key": "properties.hubProfile", "type": "FleetHubProfile"}, + "status": {"key": "properties.status", "type": "FleetStatus"}, } def __init__( @@ -336,6 +604,7 @@ def __init__( self.identity = identity self.provisioning_state = None self.hub_profile = hub_profile + self.status = None class FleetCredentialResult(_serialization.Model): @@ -477,8 +746,339 @@ class FleetListResult(_serialization.Model): def __init__(self, *, value: List["_models.Fleet"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: The Fleet items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.models.Fleet] + :keyword value: The Fleet items on this page. Required. + :paramtype value: list[~azure.mgmt.containerservicefleet.models.Fleet] + :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 FleetMember(ProxyResource): + """A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.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 cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be a + valid Azure resource id. e.g.: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long + :vartype cluster_resource_id: str + :ivar group: The group this member belongs to for multi-cluster update management. + :vartype group: str + :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", + "Failed", "Canceled", "Joining", "Leaving", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.containerservicefleet.models.FleetMemberProvisioningState + :ivar labels: The labels for the fleet member. + :vartype labels: dict[str, str] + :ivar status: Status information of the last operation for fleet member. + :vartype status: ~azure.mgmt.containerservicefleet.models.FleetMemberStatus + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "e_tag": {"readonly": True}, + "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "e_tag": {"key": "eTag", "type": "str"}, + "cluster_resource_id": {"key": "properties.clusterResourceId", "type": "str"}, + "group": {"key": "properties.group", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "labels": {"key": "properties.labels", "type": "{str}"}, + "status": {"key": "properties.status", "type": "FleetMemberStatus"}, + } + + def __init__( + self, + *, + cluster_resource_id: Optional[str] = None, + group: Optional[str] = None, + labels: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be + a valid Azure resource id. e.g.: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long + :paramtype cluster_resource_id: str + :keyword group: The group this member belongs to for multi-cluster update management. + :paramtype group: str + :keyword labels: The labels for the fleet member. + :paramtype labels: dict[str, str] + """ + super().__init__(**kwargs) + self.e_tag = None + self.cluster_resource_id = cluster_resource_id + self.group = group + self.provisioning_state = None + self.labels = labels + self.status = None + + +class FleetMemberListResult(_serialization.Model): + """The response of a FleetMember list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The FleetMember items on this page. Required. + :vartype value: list[~azure.mgmt.containerservicefleet.models.FleetMember] + :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": "[FleetMember]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.FleetMember"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The FleetMember items on this page. Required. + :paramtype value: list[~azure.mgmt.containerservicefleet.models.FleetMember] + :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 FleetMemberStatus(_serialization.Model): + """Status information for the fleet member. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar last_operation_id: The last operation ID for the fleet member. + :vartype last_operation_id: str + :ivar last_operation_error: The last operation error of the fleet member. + :vartype last_operation_error: ~azure.mgmt.containerservicefleet.models.ErrorDetail + """ + + _validation = { + "last_operation_id": {"readonly": True}, + "last_operation_error": {"readonly": True}, + } + + _attribute_map = { + "last_operation_id": {"key": "lastOperationId", "type": "str"}, + "last_operation_error": {"key": "lastOperationError", "type": "ErrorDetail"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.last_operation_id = None + self.last_operation_error = None + + +class FleetMemberUpdate(_serialization.Model): + """The type used for update operations of the FleetMember. + + :ivar group: The group this member belongs to for multi-cluster update management. + :vartype group: str + :ivar labels: The labels for the fleet member. + :vartype labels: dict[str, str] + """ + + _validation = { + "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, + } + + _attribute_map = { + "group": {"key": "properties.group", "type": "str"}, + "labels": {"key": "properties.labels", "type": "{str}"}, + } + + def __init__(self, *, group: Optional[str] = None, labels: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword group: The group this member belongs to for multi-cluster update management. + :paramtype group: str + :keyword labels: The labels for the fleet member. + :paramtype labels: dict[str, str] + """ + super().__init__(**kwargs) + self.group = group + self.labels = labels + + +class FleetPatch(_serialization.Model): + """Properties of a Fleet that can be patched. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Managed identity. + :vartype identity: ~azure.mgmt.containerservicefleet.models.ManagedServiceIdentity + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Managed identity. + :paramtype identity: ~azure.mgmt.containerservicefleet.models.ManagedServiceIdentity + """ + super().__init__(**kwargs) + self.tags = tags + self.identity = identity + + +class FleetStatus(_serialization.Model): + """Status information for the fleet. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar last_operation_id: The last operation ID for the fleet. + :vartype last_operation_id: str + :ivar last_operation_error: The last operation error for the fleet. + :vartype last_operation_error: ~azure.mgmt.containerservicefleet.models.ErrorDetail + """ + + _validation = { + "last_operation_id": {"readonly": True}, + "last_operation_error": {"readonly": True}, + } + + _attribute_map = { + "last_operation_id": {"key": "lastOperationId", "type": "str"}, + "last_operation_error": {"key": "lastOperationError", "type": "ErrorDetail"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.last_operation_id = None + self.last_operation_error = None + + +class FleetUpdateStrategy(ProxyResource): + """Defines a multi-stage process to perform update operations across members of a Fleet. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.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 UpdateStrategy resource. Known values + are: "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.containerservicefleet.models.FleetUpdateStrategyProvisioningState + :ivar strategy: Defines the update sequence of the clusters. + :vartype strategy: ~azure.mgmt.containerservicefleet.models.UpdateRunStrategy + """ + + _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"}, + "strategy": {"key": "properties.strategy", "type": "UpdateRunStrategy"}, + } + + def __init__(self, *, strategy: Optional["_models.UpdateRunStrategy"] = None, **kwargs: Any) -> None: + """ + :keyword strategy: Defines the update sequence of the clusters. + :paramtype strategy: ~azure.mgmt.containerservicefleet.models.UpdateRunStrategy + """ + super().__init__(**kwargs) + self.e_tag = None + self.provisioning_state = None + self.strategy = strategy + + +class FleetUpdateStrategyListResult(_serialization.Model): + """The response of a FleetUpdateStrategy list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The FleetUpdateStrategy items on this page. Required. + :vartype value: list[~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy] + :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": "[FleetUpdateStrategy]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.FleetUpdateStrategy"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The FleetUpdateStrategy items on this page. Required. + :paramtype value: list[~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -487,33 +1087,15 @@ 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. +class Gate(TrackedResource): + """A Gate controls the progression during a staged rollout, e.g. in an Update Run. 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. - - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -523,21 +1105,27 @@ class FleetMember(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservicefleet.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str :ivar 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 cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be a - valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :vartype cluster_resource_id: str - :ivar group: The group this member belongs to for multi-cluster update management. - :vartype group: str - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Joining", "Leaving", and "Updating". + :ivar provisioning_state: The provisioning state of the Gate resource. Known values are: + "Succeeded", "Failed", and "Canceled". :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.models.FleetMemberProvisioningState + ~azure.mgmt.containerservicefleet.models.GateProvisioningState + :ivar display_name: The human-readable display name of the Gate. + :vartype display_name: str + :ivar gate_type: The type of the Gate determines how it is completed. "Approval" + :vartype gate_type: str or ~azure.mgmt.containerservicefleet.models.GateType + :ivar target: The target that the Gate is controlling, e.g. an Update Run. + :vartype target: ~azure.mgmt.containerservicefleet.models.GateTarget + :ivar state: The state of the Gate. Known values are: "Pending", "Skipped", and "Completed". + :vartype state: str or ~azure.mgmt.containerservicefleet.models.GateState """ _validation = { @@ -545,9 +1133,10 @@ class FleetMember(ProxyResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "location": {"required": True}, "e_tag": {"readonly": True}, - "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, "provisioning_state": {"readonly": True}, + "display_name": {"max_length": 100, "min_length": 1}, } _attribute_map = { @@ -555,209 +1144,235 @@ class FleetMember(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "e_tag": {"key": "eTag", "type": "str"}, - "cluster_resource_id": {"key": "properties.clusterResourceId", "type": "str"}, - "group": {"key": "properties.group", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "gate_type": {"key": "properties.gateType", "type": "str"}, + "target": {"key": "properties.target", "type": "GateTarget"}, + "state": {"key": "properties.state", "type": "str"}, } def __init__( - self, *, cluster_resource_id: Optional[str] = None, group: Optional[str] = None, **kwargs: Any + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + display_name: Optional[str] = None, + gate_type: Optional[Union[str, "_models.GateType"]] = None, + target: Optional["_models.GateTarget"] = None, + state: Optional[Union[str, "_models.GateState"]] = None, + **kwargs: Any ) -> None: """ - :keyword cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be - a valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :paramtype cluster_resource_id: str - :keyword group: The group this member belongs to for multi-cluster update management. - :paramtype group: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword display_name: The human-readable display name of the Gate. + :paramtype display_name: str + :keyword gate_type: The type of the Gate determines how it is completed. "Approval" + :paramtype gate_type: str or ~azure.mgmt.containerservicefleet.models.GateType + :keyword target: The target that the Gate is controlling, e.g. an Update Run. + :paramtype target: ~azure.mgmt.containerservicefleet.models.GateTarget + :keyword state: The state of the Gate. Known values are: "Pending", "Skipped", and "Completed". + :paramtype state: str or ~azure.mgmt.containerservicefleet.models.GateState """ - super().__init__(**kwargs) + super().__init__(tags=tags, location=location, **kwargs) self.e_tag = None - self.cluster_resource_id = cluster_resource_id - self.group = group self.provisioning_state = None + self.display_name = display_name + self.gate_type = gate_type + self.target = target + self.state = state -class FleetMemberListResult(_serialization.Model): - """The response of a FleetMember list operation. +class GateConfiguration(_serialization.Model): + """GateConfiguration is used to define where Gates should be placed within the Update Run. All required parameters must be populated in order to send to server. - :ivar value: The FleetMember items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.models.FleetMember] - :ivar next_link: The link to the next page of items. - :vartype next_link: str + :ivar display_name: The human-readable display name of the Gate. + :vartype display_name: str + :ivar type: The type of the Gate determines how it is completed. Required. "Approval" + :vartype type: str or ~azure.mgmt.containerservicefleet.models.GateType """ _validation = { - "value": {"required": True}, + "display_name": {"max_length": 100, "min_length": 1}, + "type": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[FleetMember]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__(self, *, value: List["_models.FleetMember"], next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, *, type: Union[str, "_models.GateType"], display_name: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: The FleetMember items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.models.FleetMember] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str + :keyword display_name: The human-readable display name of the Gate. + :paramtype display_name: str + :keyword type: The type of the Gate determines how it is completed. Required. "Approval" + :paramtype type: str or ~azure.mgmt.containerservicefleet.models.GateType """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.display_name = display_name + self.type = type -class FleetMemberUpdate(_serialization.Model): - """The type used for update operations of the FleetMember. +class GateListResult(_serialization.Model): + """The response of a Gate list operation. - :ivar group: The group this member belongs to for multi-cluster update management. - :vartype group: str + All required parameters must be populated in order to send to server. + + :ivar value: The Gate items on this page. Required. + :vartype value: list[~azure.mgmt.containerservicefleet.models.Gate] + :ivar next_link: The link to the next page of items. + :vartype next_link: str """ _validation = { - "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, + "value": {"required": True}, } _attribute_map = { - "group": {"key": "properties.group", "type": "str"}, + "value": {"key": "value", "type": "[Gate]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, group: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.Gate"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword group: The group this member belongs to for multi-cluster update management. - :paramtype group: str + :keyword value: The Gate items on this page. Required. + :paramtype value: list[~azure.mgmt.containerservicefleet.models.Gate] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) - self.group = group + self.value = value + self.next_link = next_link -class FleetPatch(_serialization.Model): - """Properties of a Fleet that can be patched. +class GatePatch(_serialization.Model): + """Patch a Gate resource. :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar identity: Managed identity. - :vartype identity: ~azure.mgmt.containerservicefleet.models.ManagedServiceIdentity + :ivar properties: Properties of a Gate that can be patched. + :vartype properties: ~azure.mgmt.containerservicefleet.models.GatePatchProperties """ _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "properties": {"key": "properties", "type": "GatePatchProperties"}, } def __init__( self, *, tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, + properties: Optional["_models.GatePatchProperties"] = None, **kwargs: Any ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword identity: Managed identity. - :paramtype identity: ~azure.mgmt.containerservicefleet.models.ManagedServiceIdentity + :keyword properties: Properties of a Gate that can be patched. + :paramtype properties: ~azure.mgmt.containerservicefleet.models.GatePatchProperties """ super().__init__(**kwargs) self.tags = tags - self.identity = identity + self.properties = properties -class FleetUpdateStrategy(ProxyResource): - """Defines a multi-stage process to perform update operations across members of a Fleet. +class GatePatchProperties(_serialization.Model): + """Properties of a Gate that can be patched. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar state: The state of the Gate. Known values are: "Pending", "Skipped", and "Completed". + :vartype state: str or ~azure.mgmt.containerservicefleet.models.GateState + """ + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + } + + def __init__(self, *, state: Optional[Union[str, "_models.GateState"]] = None, **kwargs: Any) -> None: + """ + :keyword state: The state of the Gate. Known values are: "Pending", "Skipped", and "Completed". + :paramtype state: str or ~azure.mgmt.containerservicefleet.models.GateState + """ + super().__init__(**kwargs) + self.state = state + + +class GateTarget(_serialization.Model): + """The target that the Gate is controlling, e.g. an Update Run. Exactly one of the properties + objects will be set. + + All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: The resource id that the Gate is controlling the rollout of. Required. :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 UpdateStrategy resource. Known values - are: "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.models.FleetUpdateStrategyProvisioningState - :ivar strategy: Defines the update sequence of the clusters. - :vartype strategy: ~azure.mgmt.containerservicefleet.models.UpdateRunStrategy + :ivar update_run_properties: The properties of the Update Run that the Gate is targeting. + :vartype update_run_properties: + ~azure.mgmt.containerservicefleet.models.UpdateRunGateTargetProperties """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, + "id": {"required": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "strategy": {"key": "properties.strategy", "type": "UpdateRunStrategy"}, + "update_run_properties": {"key": "updateRunProperties", "type": "UpdateRunGateTargetProperties"}, } - def __init__(self, *, strategy: Optional["_models.UpdateRunStrategy"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + update_run_properties: Optional["_models.UpdateRunGateTargetProperties"] = None, + **kwargs: Any + ) -> None: """ - :keyword strategy: Defines the update sequence of the clusters. - :paramtype strategy: ~azure.mgmt.containerservicefleet.models.UpdateRunStrategy + :keyword id: The resource id that the Gate is controlling the rollout of. Required. + :paramtype id: str + :keyword update_run_properties: The properties of the Update Run that the Gate is targeting. + :paramtype update_run_properties: + ~azure.mgmt.containerservicefleet.models.UpdateRunGateTargetProperties """ super().__init__(**kwargs) - self.e_tag = None - self.provisioning_state = None - self.strategy = strategy + self.id = id + self.update_run_properties = update_run_properties -class FleetUpdateStrategyListResult(_serialization.Model): - """The response of a FleetUpdateStrategy list operation. +class GenerateResponse(_serialization.Model): + """GenerateResponse is the response of a generate request. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. - :ivar value: The FleetUpdateStrategy items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy] - :ivar next_link: The link to the next page of items. - :vartype next_link: str + :ivar id: The ARM resource id of the generated UpdateRun. e.g.: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}'. # pylint: disable=line-too-long + Required. + :vartype id: str """ _validation = { - "value": {"required": True}, + "id": {"required": True, "readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[FleetUpdateStrategy]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, *, value: List["_models.FleetUpdateStrategy"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The FleetUpdateStrategy items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.id = None class ManagedClusterUpdate(_serialization.Model): @@ -952,8 +1567,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 +1586,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): @@ -1280,6 +1920,10 @@ class UpdateGroup(_serialization.Model): :ivar name: Name of the group. It must match a group name of an existing fleet member. Required. :vartype name: str + :ivar before_gates: A list of Gates that will be created before this Group is executed. + :vartype before_gates: list[~azure.mgmt.containerservicefleet.models.GateConfiguration] + :ivar after_gates: A list of Gates that will be created after this Group is executed. + :vartype after_gates: list[~azure.mgmt.containerservicefleet.models.GateConfiguration] """ _validation = { @@ -1288,16 +1932,31 @@ class UpdateGroup(_serialization.Model): _attribute_map = { "name": {"key": "name", "type": "str"}, + "before_gates": {"key": "beforeGates", "type": "[GateConfiguration]"}, + "after_gates": {"key": "afterGates", "type": "[GateConfiguration]"}, } - def __init__(self, *, name: str, **kwargs: Any) -> None: + def __init__( + self, + *, + name: str, + before_gates: Optional[List["_models.GateConfiguration"]] = None, + after_gates: Optional[List["_models.GateConfiguration"]] = None, + **kwargs: Any + ) -> None: """ :keyword name: Name of the group. It must match a group name of an existing fleet member. Required. :paramtype name: str + :keyword before_gates: A list of Gates that will be created before this Group is executed. + :paramtype before_gates: list[~azure.mgmt.containerservicefleet.models.GateConfiguration] + :keyword after_gates: A list of Gates that will be created after this Group is executed. + :paramtype after_gates: list[~azure.mgmt.containerservicefleet.models.GateConfiguration] """ super().__init__(**kwargs) self.name = name + self.before_gates = before_gates + self.after_gates = after_gates class UpdateGroupStatus(_serialization.Model): @@ -1311,18 +1970,26 @@ class UpdateGroupStatus(_serialization.Model): :vartype name: str :ivar members: The list of member this UpdateGroup updates. :vartype members: list[~azure.mgmt.containerservicefleet.models.MemberUpdateStatus] + :ivar before_gates: The list of Gates that will run before this UpdateGroup. + :vartype before_gates: list[~azure.mgmt.containerservicefleet.models.UpdateRunGateStatus] + :ivar after_gates: The list of Gates that will run after this UpdateGroup. + :vartype after_gates: list[~azure.mgmt.containerservicefleet.models.UpdateRunGateStatus] """ _validation = { "status": {"readonly": True}, "name": {"readonly": True}, "members": {"readonly": True}, + "before_gates": {"readonly": True}, + "after_gates": {"readonly": True}, } _attribute_map = { "status": {"key": "status", "type": "UpdateStatus"}, "name": {"key": "name", "type": "str"}, "members": {"key": "members", "type": "[MemberUpdateStatus]"}, + "before_gates": {"key": "beforeGates", "type": "[UpdateRunGateStatus]"}, + "after_gates": {"key": "afterGates", "type": "[UpdateRunGateStatus]"}, } def __init__(self, **kwargs: Any) -> None: @@ -1331,6 +1998,8 @@ def __init__(self, **kwargs: Any) -> None: self.status = None self.name = None self.members = None + self.before_gates = None + self.after_gates = None class UpdateRun(ProxyResource): @@ -1338,8 +2007,8 @@ class UpdateRun(ProxyResource): 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 + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1386,6 +2055,9 @@ class UpdateRun(ProxyResource): :vartype managed_cluster_update: ~azure.mgmt.containerservicefleet.models.ManagedClusterUpdate :ivar status: The status of the UpdateRun. :vartype status: ~azure.mgmt.containerservicefleet.models.UpdateRunStatus + :ivar auto_upgrade_profile_id: AutoUpgradeProfileId is the id of an auto upgrade profile + resource. + :vartype auto_upgrade_profile_id: str """ _validation = { @@ -1396,6 +2068,7 @@ class UpdateRun(ProxyResource): "e_tag": {"readonly": True}, "provisioning_state": {"readonly": True}, "status": {"readonly": True}, + "auto_upgrade_profile_id": {"readonly": True}, } _attribute_map = { @@ -1409,6 +2082,7 @@ class UpdateRun(ProxyResource): "strategy": {"key": "properties.strategy", "type": "UpdateRunStrategy"}, "managed_cluster_update": {"key": "properties.managedClusterUpdate", "type": "ManagedClusterUpdate"}, "status": {"key": "properties.status", "type": "UpdateRunStatus"}, + "auto_upgrade_profile_id": {"key": "properties.autoUpgradeProfileId", "type": "str"}, } def __init__( @@ -1455,6 +2129,91 @@ def __init__( self.strategy = strategy self.managed_cluster_update = managed_cluster_update self.status = None + self.auto_upgrade_profile_id = None + + +class UpdateRunGateStatus(_serialization.Model): + """The status of the Gate, as represented in the Update Run. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar display_name: The human-readable display name of the Gate. + :vartype display_name: str + :ivar gate_id: The resource id of the Gate. + :vartype gate_id: str + :ivar status: The status of the Gate. + :vartype status: ~azure.mgmt.containerservicefleet.models.UpdateStatus + """ + + _validation = { + "display_name": {"readonly": True, "max_length": 100, "min_length": 1}, + "gate_id": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "display_name": {"key": "displayName", "type": "str"}, + "gate_id": {"key": "gateId", "type": "str"}, + "status": {"key": "status", "type": "UpdateStatus"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.display_name = None + self.gate_id = None + self.status = None + + +class UpdateRunGateTargetProperties(_serialization.Model): + """The properties of the Update Run that the Gate is targeting. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar name: The name of the Update Run. Required. + :vartype name: str + :ivar stage: The Update Stage of the Update Run. + :vartype stage: str + :ivar group: The Update Group of the Update Run. + :vartype group: str + :ivar timing: Whether the Gate is placed before or after the update itself. Required. Known + values are: "Before" and "After". + :vartype timing: str or ~azure.mgmt.containerservicefleet.models.Timing + """ + + _validation = { + "name": { + "required": True, + "readonly": True, + "max_length": 50, + "min_length": 1, + "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", + }, + "stage": {"readonly": True, "max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, + "group": {"readonly": True, "max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, + "timing": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "stage": {"key": "stage", "type": "str"}, + "group": {"key": "group", "type": "str"}, + "timing": {"key": "timing", "type": "str"}, + } + + def __init__(self, *, timing: Union[str, "_models.Timing"], **kwargs: Any) -> None: + """ + :keyword timing: Whether the Gate is placed before or after the update itself. Required. Known + values are: "Before" and "After". + :paramtype timing: str or ~azure.mgmt.containerservicefleet.models.Timing + """ + super().__init__(**kwargs) + self.name = None + self.stage = None + self.group = None + self.timing = timing class UpdateRunListResult(_serialization.Model): @@ -1571,6 +2330,10 @@ class UpdateStage(_serialization.Model): :ivar after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage before starting the next one. Defaults to 0 seconds if unspecified. :vartype after_stage_wait_in_seconds: int + :ivar before_gates: A list of Gates that will be created before this Stage is executed. + :vartype before_gates: list[~azure.mgmt.containerservicefleet.models.GateConfiguration] + :ivar after_gates: A list of Gates that will be created after this Stage is executed. + :vartype after_gates: list[~azure.mgmt.containerservicefleet.models.GateConfiguration] """ _validation = { @@ -1581,6 +2344,8 @@ class UpdateStage(_serialization.Model): "name": {"key": "name", "type": "str"}, "groups": {"key": "groups", "type": "[UpdateGroup]"}, "after_stage_wait_in_seconds": {"key": "afterStageWaitInSeconds", "type": "int"}, + "before_gates": {"key": "beforeGates", "type": "[GateConfiguration]"}, + "after_gates": {"key": "afterGates", "type": "[GateConfiguration]"}, } def __init__( @@ -1589,6 +2354,8 @@ def __init__( name: str, groups: Optional[List["_models.UpdateGroup"]] = None, after_stage_wait_in_seconds: Optional[int] = None, + before_gates: Optional[List["_models.GateConfiguration"]] = None, + after_gates: Optional[List["_models.GateConfiguration"]] = None, **kwargs: Any ) -> None: """ @@ -1600,11 +2367,17 @@ def __init__( :keyword after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage before starting the next one. Defaults to 0 seconds if unspecified. :paramtype after_stage_wait_in_seconds: int + :keyword before_gates: A list of Gates that will be created before this Stage is executed. + :paramtype before_gates: list[~azure.mgmt.containerservicefleet.models.GateConfiguration] + :keyword after_gates: A list of Gates that will be created after this Stage is executed. + :paramtype after_gates: list[~azure.mgmt.containerservicefleet.models.GateConfiguration] """ super().__init__(**kwargs) self.name = name self.groups = groups self.after_stage_wait_in_seconds = after_stage_wait_in_seconds + self.before_gates = before_gates + self.after_gates = after_gates class UpdateStageStatus(_serialization.Model): @@ -1618,6 +2391,10 @@ class UpdateStageStatus(_serialization.Model): :vartype name: str :ivar groups: The list of groups to be updated as part of this UpdateStage. :vartype groups: list[~azure.mgmt.containerservicefleet.models.UpdateGroupStatus] + :ivar before_gates: The list of Gates that will run before this UpdateStage. + :vartype before_gates: list[~azure.mgmt.containerservicefleet.models.UpdateRunGateStatus] + :ivar after_gates: The list of Gates that will run after this UpdateStage. + :vartype after_gates: list[~azure.mgmt.containerservicefleet.models.UpdateRunGateStatus] :ivar after_stage_wait_status: The status of the wait period configured on the UpdateStage. :vartype after_stage_wait_status: ~azure.mgmt.containerservicefleet.models.WaitStatus """ @@ -1626,6 +2403,8 @@ class UpdateStageStatus(_serialization.Model): "status": {"readonly": True}, "name": {"readonly": True}, "groups": {"readonly": True}, + "before_gates": {"readonly": True}, + "after_gates": {"readonly": True}, "after_stage_wait_status": {"readonly": True}, } @@ -1633,6 +2412,8 @@ class UpdateStageStatus(_serialization.Model): "status": {"key": "status", "type": "UpdateStatus"}, "name": {"key": "name", "type": "str"}, "groups": {"key": "groups", "type": "[UpdateGroupStatus]"}, + "before_gates": {"key": "beforeGates", "type": "[UpdateRunGateStatus]"}, + "after_gates": {"key": "afterGates", "type": "[UpdateRunGateStatus]"}, "after_stage_wait_status": {"key": "afterStageWaitStatus", "type": "WaitStatus"}, } @@ -1642,6 +2423,8 @@ def __init__(self, **kwargs: Any) -> None: self.status = None self.name = None self.groups = None + self.before_gates = None + self.after_gates = None self.after_stage_wait_status = None @@ -1655,7 +2438,7 @@ class UpdateStatus(_serialization.Model): :ivar completed_time: The time the operation or group was completed. :vartype completed_time: ~datetime.datetime :ivar state: The State of the operation or group. Known values are: "NotStarted", "Running", - "Stopping", "Stopped", "Skipped", "Failed", and "Completed". + "Stopping", "Stopped", "Skipped", "Failed", "Pending", and "Completed". :vartype state: str or ~azure.mgmt.containerservicefleet.models.UpdateState :ivar error: The error details when a failure is encountered. :vartype error: ~azure.mgmt.containerservicefleet.models.ErrorDetail 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..3c9c3fe0dba8 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,35 @@ # 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 ._auto_upgrade_profile_operations_operations import AutoUpgradeProfileOperationsOperations # type: ignore +from ._gates_operations import GatesOperations # 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", + "AutoUpgradeProfileOperationsOperations", + "GatesOperations", "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_profile_operations_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_auto_upgrade_profile_operations_operations.py new file mode 100644 index 000000000000..0483fe2f8877 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_auto_upgrade_profile_operations_operations.py @@ -0,0 +1,229 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterator, Optional, TypeVar, Union, cast + +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 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_generate_update_run_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}/generateUpdateRun", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class AutoUpgradeProfileOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservicefleet.ContainerServiceFleetMgmtClient`'s + :attr:`auto_upgrade_profile_operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _generate_update_run_initial( + self, resource_group_name: str, fleet_name: str, auto_upgrade_profile_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = 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_generate_update_run_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) + + _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, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["If-Match"] = self._deserialize("str", response.headers.get("If-Match")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + 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_generate_update_run( + self, resource_group_name: str, fleet_name: str, auto_upgrade_profile_name: str, **kwargs: Any + ) -> LROPoller[_models.GenerateResponse]: + """A long-running resource action. + + :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: An instance of LROPoller that returns either GenerateResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.GenerateResponse] + :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.GenerateResponse] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._generate_update_run_initial( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + auto_upgrade_profile_name=auto_upgrade_profile_name, + 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): + deserialized = self._deserialize("GenerateResponse", 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.GenerateResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GenerateResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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..aa82378486fa --- /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"), + "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"), + "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"), + "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"), + "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..12633c94c940 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 @@ -59,7 +59,7 @@ def build_list_by_fleet_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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 @@ -94,7 +94,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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") @@ -145,7 +145,7 @@ def build_create_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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") @@ -201,7 +201,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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 @@ -254,7 +254,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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..32b05664e36a 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 @@ -59,7 +58,7 @@ def build_list_by_fleet_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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 @@ -94,7 +93,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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") @@ -145,7 +144,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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 @@ -200,7 +199,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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..68021381ec8c 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,13 +48,13 @@ 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 _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -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 @@ -81,7 +81,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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 @@ -111,7 +111,7 @@ def build_get_request(resource_group_name: str, fleet_name: str, subscription_id "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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") @@ -153,7 +153,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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") @@ -195,7 +195,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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 @@ -234,7 +234,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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 @@ -271,7 +271,7 @@ def build_list_credentials_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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/_gates_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_gates_operations.py new file mode 100644 index 000000000000..80820dded866 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_gates_operations.py @@ -0,0 +1,578 @@ +# 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}/gates", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "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, gate_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}/gates/{gateName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "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])?$" + ), + "gateName": _SERIALIZER.url( + "gate_name", + gate_name, + "str", + max_length=36, + min_length=36, + pattern=r"^[0-9a-f]{8}[-][0-9a-f]{4}[-][0-9a-f]{4}[-][0-9a-f]{4}[-][0-9a-f]{12}$", + ), + } + + _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_update_request( + resource_group_name: str, + fleet_name: str, + gate_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}/gates/{gateName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "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])?$" + ), + "gateName": _SERIALIZER.url( + "gate_name", + gate_name, + "str", + max_length=36, + min_length=36, + pattern=r"^[0-9a-f]{8}[-][0-9a-f]{4}[-][0-9a-f]{4}[-][0-9a-f]{4}[-][0-9a-f]{12}$", + ), + } + + _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class GatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservicefleet.ContainerServiceFleetMgmtClient`'s + :attr:`gates` 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.Gate"]: + """List Gate 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 Gate or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.models.Gate] + :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.GateListResult] = 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("GateListResult", 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, gate_name: str, **kwargs: Any) -> _models.Gate: + """Get a Gate. + + :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 gate_name: The name of the Gate resource, a GUID. Required. + :type gate_name: str + :return: Gate or the result of cls(response) + :rtype: ~azure.mgmt.containerservicefleet.models.Gate + :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.Gate] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + gate_name=gate_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("Gate", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_initial( + self, + resource_group_name: str, + fleet_name: str, + gate_name: str, + properties: Union[_models.GatePatch, 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(properties, (IOBase, bytes)): + _content = properties + else: + _json = self._serialize.body(properties, "GatePatch") + + _request = build_update_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + gate_name=gate_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, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = 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 + + @overload + def begin_update( + self, + resource_group_name: str, + fleet_name: str, + gate_name: str, + properties: _models.GatePatch, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Gate]: + """Update a Gate. + + :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 gate_name: The name of the Gate resource, a GUID. Required. + :type gate_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.containerservicefleet.models.GatePatch + :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 Gate or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.Gate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + fleet_name: str, + gate_name: str, + properties: IO[bytes], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Gate]: + """Update a Gate. + + :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 gate_name: The name of the Gate resource, a GUID. Required. + :type gate_name: str + :param properties: The resource properties to be updated. Required. + :type properties: 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 Gate or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.Gate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + fleet_name: str, + gate_name: str, + properties: Union[_models.GatePatch, IO[bytes]], + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.Gate]: + """Update a Gate. + + :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 gate_name: The name of the Gate resource, a GUID. Required. + :type gate_name: str + :param properties: The resource properties to be updated. Is either a GatePatch type or a + IO[bytes] type. Required. + :type properties: ~azure.mgmt.containerservicefleet.models.GatePatch 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 Gate or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.Gate] + :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.Gate] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + gate_name=gate_name, + properties=properties, + 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("Gate", 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": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Gate].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Gate]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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..1ab90920cec7 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 @@ -59,7 +59,7 @@ def build_list_by_fleet_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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 @@ -94,7 +94,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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") @@ -145,7 +145,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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 @@ -200,7 +200,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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") @@ -252,7 +252,7 @@ def build_skip_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/skip", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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 @@ -305,7 +305,7 @@ def build_start_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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 @@ -356,7 +356,7 @@ def build_stop_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -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_profile_operations_generate_update_run_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profile_operations_generate_update_run_maximum_set_gen.py new file mode 100644 index 000000000000..6103f2ab0e8b --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profile_operations_generate_update_run_maximum_set_gen.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_profile_operations_generate_update_run_maximum_set_gen.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_profile_operations.begin_generate_update_run( + resource_group_name="rgfleets", + fleet_name="fleet1", + auto_upgrade_profile_name="aup1", + ).result() + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/AutoUpgradeProfileOperations_GenerateUpdateRun_MaximumSet_Gen.json +if __name__ == "__main__": + main() 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_create_or_update_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_create_or_update_maximum_set_gen.py new file mode 100644 index 000000000000..4e6593fe0b88 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_create_or_update_maximum_set_gen.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.containerservicefleet import ContainerServiceFleetMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerservicefleet +# USAGE + python auto_upgrade_profiles_create_or_update_maximum_set_gen.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="rgfleets", + fleet_name="fleet1", + auto_upgrade_profile_name="autoupgradeprofile1", + resource={ + "properties": { + "channel": "Stable", + "disabled": True, + "nodeImageSelection": {"type": "Latest"}, + "updateStrategyId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.ContainerService/fleets/fleet1/updateStrategies/strategy1", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/AutoUpgradeProfiles_CreateOrUpdate_MaximumSet_Gen.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..a46e8f87db4a --- /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="00000000-0000-0000-0000-000000000000", + ) + + 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_delete_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_delete_maximum_set_gen.py new file mode 100644 index 000000000000..4f2d903a4e49 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_delete_maximum_set_gen.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_maximum_set_gen.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", + ) + + client.auto_upgrade_profiles.begin_delete( + resource_group_name="rgfleets", + 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_MaximumSet_Gen.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_get_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_get_maximum_set_gen.py new file mode 100644 index 000000000000..8ca00ecadac3 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_get_maximum_set_gen.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_maximum_set_gen.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="rgfleets", + 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_MaximumSet_Gen.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/auto_upgrade_profiles_list_by_fleet_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_list_by_fleet_maximum_set_gen.py new file mode 100644 index 000000000000..1981372c6157 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_list_by_fleet_maximum_set_gen.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_maximum_set_gen.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="rgfleets", + 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_MaximumSet_Gen.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..216e12dac79b 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 @@ -27,7 +27,7 @@ def main(): client = ContainerServiceFleetMgmtClient( credential=DefaultAzureCredential(), - subscription_id="subid1", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.fleet_members.begin_create( @@ -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_create_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_create_maximum_set_gen.py new file mode 100644 index 000000000000..33eb6b7a1d53 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_create_maximum_set_gen.py @@ -0,0 +1,49 @@ +# 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 fleet_members_create_maximum_set_gen.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.fleet_members.begin_create( + resource_group_name="rgfleets", + fleet_name="fleet1", + fleet_member_name="fleet1", + resource={ + "properties": { + "clusterResourceId": "/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1", + "group": "fleet1", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/FleetMembers_Create_MaximumSet_Gen.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..3b33e0584da5 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 @@ -27,7 +27,7 @@ def main(): client = ContainerServiceFleetMgmtClient( credential=DefaultAzureCredential(), - subscription_id="subid1", + subscription_id="00000000-0000-0000-0000-000000000000", ) client.fleet_members.begin_delete( @@ -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_delete_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_delete_maximum_set_gen.py new file mode 100644 index 000000000000..06b637aab656 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_delete_maximum_set_gen.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 fleet_members_delete_maximum_set_gen.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", + ) + + client.fleet_members.begin_delete( + resource_group_name="rgfleets", + fleet_name="fleet1", + fleet_member_name="fleet1", + ).result() + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/FleetMembers_Delete_MaximumSet_Gen.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..980658418d40 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 @@ -27,7 +27,7 @@ def main(): client = ContainerServiceFleetMgmtClient( credential=DefaultAzureCredential(), - subscription_id="subid1", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.fleet_members.get( @@ -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_get_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_get_maximum_set_gen.py new file mode 100644 index 000000000000..2562b2d24aff --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_get_maximum_set_gen.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 fleet_members_get_maximum_set_gen.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.fleet_members.get( + resource_group_name="rgfleets", + fleet_name="fleet1", + fleet_member_name="fleet1", + ) + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/FleetMembers_Get_MaximumSet_Gen.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..7e7c3d620dd5 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 @@ -27,7 +27,7 @@ def main(): client = ContainerServiceFleetMgmtClient( credential=DefaultAzureCredential(), - subscription_id="subid1", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.fleet_members.list_by_fleet( @@ -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_list_by_fleet_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_list_by_fleet_maximum_set_gen.py new file mode 100644 index 000000000000..8c372b24b1a0 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_list_by_fleet_maximum_set_gen.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 fleet_members_list_by_fleet_maximum_set_gen.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.fleet_members.list_by_fleet( + resource_group_name="rgfleets", + 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/FleetMembers_ListByFleet_MaximumSet_Gen.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..263764c8aefb 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 @@ -27,7 +27,7 @@ def main(): client = ContainerServiceFleetMgmtClient( credential=DefaultAzureCredential(), - subscription_id="subid1", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.fleet_members.begin_update( @@ -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/fleet_members_update_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_update_maximum_set_gen.py new file mode 100644 index 000000000000..0cf3d1075977 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_update_maximum_set_gen.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 fleet_members_update_maximum_set_gen.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.fleet_members.begin_update( + resource_group_name="rgfleets", + fleet_name="fleet1", + fleet_member_name="fleet1", + properties={"properties": {"group": "staging"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/FleetMembers_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_update_strategies_create_or_update_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_update_strategies_create_or_update_maximum_set_gen.py new file mode 100644 index 000000000000..74c85fbf7f4b --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_update_strategies_create_or_update_maximum_set_gen.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.containerservicefleet import ContainerServiceFleetMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerservicefleet +# USAGE + python fleet_update_strategies_create_or_update_maximum_set_gen.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.fleet_update_strategies.begin_create_or_update( + resource_group_name="rgfleets", + fleet_name="fleet1", + update_strategy_name="fleet1", + resource={ + "properties": { + "strategy": { + "stages": [{"afterStageWaitInSeconds": 3600, "groups": [{"name": "group-a"}], "name": "stage1"}] + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/FleetUpdateStrategies_CreateOrUpdate_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_update_strategies_delete_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_update_strategies_delete_maximum_set_gen.py new file mode 100644 index 000000000000..c5c709456325 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_update_strategies_delete_maximum_set_gen.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 fleet_update_strategies_delete_maximum_set_gen.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", + ) + + client.fleet_update_strategies.begin_delete( + resource_group_name="rgfleets", + fleet_name="fleet1", + update_strategy_name="fleet1", + ).result() + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/FleetUpdateStrategies_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_update_strategies_get_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_update_strategies_get_maximum_set_gen.py new file mode 100644 index 000000000000..1368c3b48dba --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_update_strategies_get_maximum_set_gen.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 fleet_update_strategies_get_maximum_set_gen.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.fleet_update_strategies.get( + resource_group_name="rgfleets", + fleet_name="fleet1", + update_strategy_name="fleet1", + ) + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/FleetUpdateStrategies_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_update_strategies_list_by_fleet_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_update_strategies_list_by_fleet_maximum_set_gen.py new file mode 100644 index 000000000000..9270dfcf44ce --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_update_strategies_list_by_fleet_maximum_set_gen.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 fleet_update_strategies_list_by_fleet_maximum_set_gen.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.fleet_update_strategies.list_by_fleet( + resource_group_name="rgfleets", + 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/FleetUpdateStrategies_ListByFleet_MaximumSet_Gen.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..fa240f51a07f 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 @@ -27,7 +27,7 @@ def main(): client = ContainerServiceFleetMgmtClient( credential=DefaultAzureCredential(), - subscription_id="subid1", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.fleets.begin_create_or_update( @@ -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_create_or_update_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_create_or_update_maximum_set_gen.py new file mode 100644 index 000000000000..b536a9ac4953 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_create_or_update_maximum_set_gen.py @@ -0,0 +1,61 @@ +# 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 fleets_create_or_update_maximum_set_gen.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.fleets.begin_create_or_update( + resource_group_name="rgfleets", + fleet_name="fleet1", + resource={ + "identity": {"type": "None", "userAssignedIdentities": {"key126": {}}}, + "location": "East US", + "properties": { + "hubProfile": { + "agentProfile": { + "subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1", + "vmSize": "Standard_DS1", + }, + "apiServerAccessProfile": { + "enablePrivateCluster": True, + "enableVnetIntegration": True, + "subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1", + }, + "dnsPrefix": "dnsprefix1", + } + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Fleets_CreateOrUpdate_MaximumSet_Gen.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..6c8e3c8e5229 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_delete.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_delete.py @@ -27,7 +27,7 @@ def main(): client = ContainerServiceFleetMgmtClient( credential=DefaultAzureCredential(), - subscription_id="subid1", + subscription_id="00000000-0000-0000-0000-000000000000", ) client.fleets.begin_delete( @@ -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_delete_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_delete_maximum_set_gen.py new file mode 100644 index 000000000000..360458b1bda4 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_delete_maximum_set_gen.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.containerservicefleet import ContainerServiceFleetMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerservicefleet +# USAGE + python fleets_delete_maximum_set_gen.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", + ) + + client.fleets.begin_delete( + resource_group_name="rgfleets", + fleet_name="fleet1", + ).result() + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Fleets_Delete_MaximumSet_Gen.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..5f114f616099 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_get.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_get.py @@ -27,7 +27,7 @@ def main(): client = ContainerServiceFleetMgmtClient( credential=DefaultAzureCredential(), - subscription_id="subid1", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.fleets.get( @@ -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_get_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_get_maximum_set_gen.py new file mode 100644 index 000000000000..cd9f01c1a558 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_get_maximum_set_gen.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 fleets_get_maximum_set_gen.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.fleets.get( + resource_group_name="rgfleets", + fleet_name="fleet1", + ) + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Fleets_Get_MaximumSet_Gen.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..f720b08af62d 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 @@ -27,7 +27,7 @@ def main(): client = ContainerServiceFleetMgmtClient( credential=DefaultAzureCredential(), - subscription_id="subid1", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.fleets.list_by_resource_group( @@ -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_resource_group_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_resource_group_maximum_set_gen.py new file mode 100644 index 000000000000..fc8a0cd51616 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_resource_group_maximum_set_gen.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 fleets_list_by_resource_group_maximum_set_gen.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.fleets.list_by_resource_group( + resource_group_name="rgfleets", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Fleets_ListByResourceGroup_MaximumSet_Gen.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..a20d99c13866 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 @@ -27,7 +27,7 @@ def main(): client = ContainerServiceFleetMgmtClient( credential=DefaultAzureCredential(), - subscription_id="subid1", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.fleets.list_by_subscription() @@ -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_by_subscription_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..19950ef185fc --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.containerservicefleet import ContainerServiceFleetMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerservicefleet +# USAGE + python fleets_list_by_subscription_maximum_set_gen.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.fleets.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Fleets_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_credentials_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_credentials_maximum_set_gen.py new file mode 100644 index 000000000000..1f9df24188cf --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_credentials_maximum_set_gen.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 fleets_list_credentials_maximum_set_gen.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.fleets.list_credentials( + resource_group_name="rgfleets", + fleet_name="fleet1", + ) + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Fleets_ListCredentials_MaximumSet_Gen.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..b4b2173615d8 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 @@ -27,7 +27,7 @@ def main(): client = ContainerServiceFleetMgmtClient( credential=DefaultAzureCredential(), - subscription_id="subid1", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.fleets.list_credentials( @@ -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..b7cc139ddf9d 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 @@ -27,7 +27,7 @@ def main(): client = ContainerServiceFleetMgmtClient( credential=DefaultAzureCredential(), - subscription_id="subid1", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.fleets.begin_update( @@ -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/fleets_update_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_update_maximum_set_gen.py new file mode 100644 index 000000000000..0c4242bd07c8 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_update_maximum_set_gen.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 fleets_update_maximum_set_gen.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.fleets.begin_update( + resource_group_name="rgfleets", + fleet_name="fleet1", + properties={"identity": {"type": "None", "userAssignedIdentities": {"key126": {}}}, "tags": {}}, + ).result() + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Fleets_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/gates_get.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/gates_get.py new file mode 100644 index 000000000000..0fd1eb4f1a08 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/gates_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 gates_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.gates.get( + resource_group_name="rg1", + fleet_name="fleet1", + gate_name="12345678-910a-bcde-f000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Gates_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/gates_list_by_fleet.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/gates_list_by_fleet.py new file mode 100644 index 000000000000..358182941940 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/gates_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 gates_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.gates.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/Gates_ListByFleet.json +if __name__ == "__main__": + main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/gates_update.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/gates_update.py new file mode 100644 index 000000000000..a84138fad10e --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/gates_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 gates_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.gates.begin_update( + resource_group_name="rg1", + fleet_name="fleet1", + gate_name="12345678-910a-bcde-f000-000000000000", + properties={"properties": {"state": "Completed"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Gates_Update.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/operations_list_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/operations_list_maximum_set_gen.py new file mode 100644 index 000000000000..12375fca4a23 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/operations_list_maximum_set_gen.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.containerservicefleet import ContainerServiceFleetMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerservicefleet +# USAGE + python operations_list_maximum_set_gen.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="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Operations_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/operations_list_minimum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/operations_list_minimum_set_gen.py new file mode 100644 index 000000000000..18b483bdcc12 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/operations_list_minimum_set_gen.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.containerservicefleet import ContainerServiceFleetMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-containerservicefleet +# USAGE + python operations_list_minimum_set_gen.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="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/Operations_List_MinimumSet_Gen.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..877a200315f9 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 @@ -41,7 +41,21 @@ def main(): "upgrade": {"kubernetesVersion": "1.26.1", "type": "Full"}, }, "strategy": { - "stages": [{"afterStageWaitInSeconds": 3600, "groups": [{"name": "group-a"}], "name": "stage1"}] + "stages": [ + { + "afterGates": [{"displayName": "gate after stage1", "type": "Approval"}], + "afterStageWaitInSeconds": 3600, + "beforeGates": [{"displayName": "gate before stage1", "type": "Approval"}], + "groups": [ + { + "afterGates": [{"displayName": "gate after group-a", "type": "Approval"}], + "beforeGates": [{"displayName": "gate before group-a", "type": "Approval"}], + "name": "group-a", + } + ], + "name": "stage1", + } + ] }, "updateStrategyId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1", } @@ -50,6 +64,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_create_or_update_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_create_or_update_maximum_set_gen.py new file mode 100644 index 000000000000..b40c7c368fd9 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_create_or_update_maximum_set_gen.py @@ -0,0 +1,57 @@ +# 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 update_runs_create_or_update_maximum_set_gen.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.update_runs.begin_create_or_update( + resource_group_name="rgfleets", + fleet_name="fleet1", + update_run_name="fleet1", + resource={ + "properties": { + "autoUpgradeProfileId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.ContainerService/fleets/fleet1/autoUpgradeProfiles/aup1", + "managedClusterUpdate": { + "nodeImageSelection": {"customNodeImageVersions": [{}], "type": "Latest"}, + "upgrade": {"kubernetesVersion": "1.26.1", "type": "Full"}, + }, + "status": {"nodeImageSelection": {}, "status": {"error": {}, "state": "NotStarted"}}, + "strategy": { + "stages": [{"afterStageWaitInSeconds": 3600, "groups": [{"name": "group-a"}], "name": "stage1"}] + }, + "updateStrategyId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateRuns_CreateOrUpdate_MaximumSet_Gen.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..896563b651dd 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 @@ -27,7 +27,7 @@ def main(): client = ContainerServiceFleetMgmtClient( credential=DefaultAzureCredential(), - subscription_id="subid1", + subscription_id="00000000-0000-0000-0000-000000000000", ) client.update_runs.begin_delete( @@ -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_delete_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_delete_maximum_set_gen.py new file mode 100644 index 000000000000..afb2338c4b40 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_delete_maximum_set_gen.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 update_runs_delete_maximum_set_gen.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", + ) + + client.update_runs.begin_delete( + resource_group_name="rgfleets", + fleet_name="fleet1", + update_run_name="fleet1", + ).result() + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateRuns_Delete_MaximumSet_Gen.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_get_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_get_maximum_set_gen.py new file mode 100644 index 000000000000..17f915a2c177 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_get_maximum_set_gen.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 update_runs_get_maximum_set_gen.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.update_runs.get( + resource_group_name="rgfleets", + fleet_name="fleet1", + update_run_name="fleet1", + ) + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateRuns_Get_MaximumSet_Gen.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_list_by_fleet_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_list_by_fleet_maximum_set_gen.py new file mode 100644 index 000000000000..61a8afae012e --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_list_by_fleet_maximum_set_gen.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 update_runs_list_by_fleet_maximum_set_gen.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.update_runs.list_by_fleet( + resource_group_name="rgfleets", + 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/UpdateRuns_ListByFleet_MaximumSet_Gen.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_skip_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_skip_maximum_set_gen.py new file mode 100644 index 000000000000..c5c00fb3c719 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_skip_maximum_set_gen.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 update_runs_skip_maximum_set_gen.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.update_runs.begin_skip( + resource_group_name="rgfleets", + fleet_name="fleet1", + update_run_name="fleet1", + body={"targets": [{"name": "member-one", "type": "Member"}, {"name": "stage1", "type": "AfterStageWait"}]}, + ).result() + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateRuns_Skip_MaximumSet_Gen.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_start_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_start_maximum_set_gen.py new file mode 100644 index 000000000000..69e864892460 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_start_maximum_set_gen.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 update_runs_start_maximum_set_gen.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.update_runs.begin_start( + resource_group_name="rgfleets", + fleet_name="fleet1", + update_run_name="fleet1", + ).result() + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateRuns_Start_MaximumSet_Gen.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_runs_stop_maximum_set_gen.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_stop_maximum_set_gen.py new file mode 100644 index 000000000000..3e995731b21e --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_stop_maximum_set_gen.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 update_runs_stop_maximum_set_gen.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.update_runs.begin_stop( + resource_group_name="rgfleets", + fleet_name="fleet1", + update_run_name="fleet1", + ).result() + print(response) + + +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2025-04-01-preview/examples/UpdateRuns_Stop_MaximumSet_Gen.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..2a320c04d69c 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 @@ -33,11 +33,25 @@ def main(): response = client.fleet_update_strategies.begin_create_or_update( resource_group_name="rg1", fleet_name="fleet1", - update_strategy_name="strartegy1", + update_strategy_name="strategy1", resource={ "properties": { "strategy": { - "stages": [{"afterStageWaitInSeconds": 3600, "groups": [{"name": "group-a"}], "name": "stage1"}] + "stages": [ + { + "afterGates": [{"displayName": "gate after stage1", "type": "Approval"}], + "afterStageWaitInSeconds": 3600, + "beforeGates": [{"displayName": "gate before stage1", "type": "Approval"}], + "groups": [ + { + "afterGates": [{"displayName": "gate after group-a", "type": "Approval"}], + "beforeGates": [{"displayName": "gate before group-a", "type": "Approval"}], + "name": "group-a", + } + ], + "name": "stage1", + } + ] } } }, @@ -45,6 +59,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..6419ff1ee883 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 @@ -27,7 +27,7 @@ def main(): client = ContainerServiceFleetMgmtClient( credential=DefaultAzureCredential(), - subscription_id="subid1", + subscription_id="00000000-0000-0000-0000-000000000000", ) client.fleet_update_strategies.begin_delete( @@ -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_profile_operations_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_auto_upgrade_profile_operations_operations.py new file mode 100644 index 000000000000..1100ba1a771b --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_auto_upgrade_profile_operations_operations.py @@ -0,0 +1,32 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.containerservicefleet import ContainerServiceFleetMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerServiceFleetMgmtAutoUpgradeProfileOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerServiceFleetMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_auto_upgrade_profile_operations_begin_generate_update_run(self, resource_group): + response = self.client.auto_upgrade_profile_operations.begin_generate_update_run( + resource_group_name=resource_group.name, + fleet_name="str", + auto_upgrade_profile_name="str", + 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_profile_operations_operations_async.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_auto_upgrade_profile_operations_operations_async.py new file mode 100644 index 000000000000..4327c166129d --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_auto_upgrade_profile_operations_operations_async.py @@ -0,0 +1,35 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.containerservicefleet.aio import ContainerServiceFleetMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerServiceFleetMgmtAutoUpgradeProfileOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerServiceFleetMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_auto_upgrade_profile_operations_begin_generate_update_run(self, resource_group): + response = await ( + await self.client.auto_upgrade_profile_operations.begin_generate_update_run( + resource_group_name=resource_group.name, + fleet_name="str", + auto_upgrade_profile_name="str", + 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.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_auto_upgrade_profiles_operations.py index c866c555cdcf..528ebdf62e02 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,12 +45,24 @@ 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", auto_upgrade_profile_name="str", resource={ + "autoUpgradeProfileStatus": { + "lastTriggerError": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "lastTriggerStatus": "str", + "lastTriggerUpgradeVersions": ["str"], + "lastTriggeredAt": "2020-02-20 00:00:00", + }, "channel": "str", "disabled": bool, "eTag": "str", @@ -69,7 +81,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 +89,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..abe3e97ab18f 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,13 +46,25 @@ 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, fleet_name="str", auto_upgrade_profile_name="str", resource={ + "autoUpgradeProfileStatus": { + "lastTriggerError": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "lastTriggerStatus": "str", + "lastTriggerUpgradeVersions": ["str"], + "lastTriggeredAt": "2020-02-20 00:00:00", + }, "channel": "str", "disabled": bool, "eTag": "str", @@ -71,7 +83,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 +92,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..3c545a21d84a 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", @@ -55,8 +55,19 @@ def test_begin_create(self, resource_group): "eTag": "str", "group": "str", "id": "str", + "labels": {"str": "str"}, "name": "str", "provisioningState": "str", + "status": { + "lastOperationError": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "lastOperationId": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -67,7 +78,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 +86,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", + properties={"group": "str", "labels": {"str": "str"}}, + 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 +100,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..9c80a3f7d960 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, @@ -57,8 +57,19 @@ async def test_begin_create(self, resource_group): "eTag": "str", "group": "str", "id": "str", + "labels": {"str": "str"}, "name": "str", "provisioningState": "str", + "status": { + "lastOperationError": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "lastOperationId": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -69,7 +80,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 +89,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", + properties={"group": "str", "labels": {"str": "str"}}, + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -94,13 +105,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..1bb1bf0eaeb9 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", @@ -55,7 +55,23 @@ def test_begin_create_or_update(self, resource_group): "id": "str", "name": "str", "provisioningState": "str", - "strategy": {"stages": [{"name": "str", "afterStageWaitInSeconds": 0, "groups": [{"name": "str"}]}]}, + "strategy": { + "stages": [ + { + "name": "str", + "afterGates": [{"type": "str", "displayName": "str"}], + "afterStageWaitInSeconds": 0, + "beforeGates": [{"type": "str", "displayName": "str"}], + "groups": [ + { + "name": "str", + "afterGates": [{"type": "str", "displayName": "str"}], + "beforeGates": [{"type": "str", "displayName": "str"}], + } + ], + } + ] + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -66,7 +82,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 +90,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..8eb3a0a9fb56 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, @@ -58,7 +58,21 @@ async def test_begin_create_or_update(self, resource_group): "name": "str", "provisioningState": "str", "strategy": { - "stages": [{"name": "str", "afterStageWaitInSeconds": 0, "groups": [{"name": "str"}]}] + "stages": [ + { + "name": "str", + "afterGates": [{"type": "str", "displayName": "str"}], + "afterStageWaitInSeconds": 0, + "beforeGates": [{"type": "str", "displayName": "str"}], + "groups": [ + { + "name": "str", + "afterGates": [{"type": "str", "displayName": "str"}], + "beforeGates": [{"type": "str", "displayName": "str"}], + } + ], + } + ] }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -70,7 +84,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 +93,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..f069b36b5587 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", @@ -77,6 +81,16 @@ def test_begin_create_or_update(self, resource_group): }, "name": "str", "provisioningState": "str", + "status": { + "lastOperationError": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "lastOperationId": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -88,7 +102,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 +110,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 +123,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 +131,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 +143,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..99b64545fbd0 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", @@ -79,6 +83,16 @@ async def test_begin_create_or_update(self, resource_group): }, "name": "str", "provisioningState": "str", + "status": { + "lastOperationError": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "lastOperationId": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -90,7 +104,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 +113,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 +127,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 +136,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 +150,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_gates_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_gates_operations.py new file mode 100644 index 000000000000..dac32418a271 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_gates_operations.py @@ -0,0 +1,58 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.containerservicefleet import ContainerServiceFleetMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerServiceFleetMgmtGatesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerServiceFleetMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_gates_list_by_fleet(self, resource_group): + response = self.client.gates.list_by_fleet( + resource_group_name=resource_group.name, + fleet_name="str", + api_version="2025-04-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_gates_get(self, resource_group): + response = self.client.gates.get( + resource_group_name=resource_group.name, + fleet_name="str", + gate_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_gates_begin_update(self, resource_group): + response = self.client.gates.begin_update( + resource_group_name=resource_group.name, + fleet_name="str", + gate_name="str", + properties={"properties": {"state": "str"}, "tags": {"str": "str"}}, + 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_gates_operations_async.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_gates_operations_async.py new file mode 100644 index 000000000000..140de044cd07 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_gates_operations_async.py @@ -0,0 +1,61 @@ +# 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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.containerservicefleet.aio import ContainerServiceFleetMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerServiceFleetMgmtGatesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerServiceFleetMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gates_list_by_fleet(self, resource_group): + response = self.client.gates.list_by_fleet( + resource_group_name=resource_group.name, + fleet_name="str", + api_version="2025-04-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gates_get(self, resource_group): + response = await self.client.gates.get( + resource_group_name=resource_group.name, + fleet_name="str", + gate_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gates_begin_update(self, resource_group): + response = await ( + await self.client.gates.begin_update( + resource_group_name=resource_group.name, + fleet_name="str", + gate_name="str", + properties={"properties": {"state": "str"}, "tags": {"str": "str"}}, + 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_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..acaa82f4dfe9 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,17 +45,18 @@ 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", update_run_name="str", resource={ + "autoUpgradeProfileId": "str", "eTag": "str", "id": "str", "managedClusterUpdate": { "upgrade": {"type": "str", "kubernetesVersion": "str"}, - "nodeImageSelection": {"type": "str"}, + "nodeImageSelection": {"type": "str", "customNodeImageVersions": [{"version": "str"}]}, }, "name": "str", "provisioningState": "str", @@ -63,6 +64,24 @@ def test_begin_create_or_update(self, resource_group): "nodeImageSelection": {"selectedNodeImageVersions": [{"version": "str"}]}, "stages": [ { + "afterGates": [ + { + "displayName": "str", + "gateId": "str", + "status": { + "completedTime": "2020-02-20 00:00:00", + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + } + ], "afterStageWaitStatus": { "status": { "completedTime": "2020-02-20 00:00:00", @@ -78,8 +97,62 @@ def test_begin_create_or_update(self, resource_group): }, "waitDurationInSeconds": 0, }, + "beforeGates": [ + { + "displayName": "str", + "gateId": "str", + "status": { + "completedTime": "2020-02-20 00:00:00", + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + } + ], "groups": [ { + "afterGates": [ + { + "displayName": "str", + "gateId": "str", + "status": { + "completedTime": "2020-02-20 00:00:00", + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + } + ], + "beforeGates": [ + { + "displayName": "str", + "gateId": "str", + "status": { + "completedTime": "2020-02-20 00:00:00", + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + } + ], "members": [ { "clusterResourceId": "str", @@ -143,7 +216,23 @@ def test_begin_create_or_update(self, resource_group): "state": "str", }, }, - "strategy": {"stages": [{"name": "str", "afterStageWaitInSeconds": 0, "groups": [{"name": "str"}]}]}, + "strategy": { + "stages": [ + { + "name": "str", + "afterGates": [{"type": "str", "displayName": "str"}], + "afterStageWaitInSeconds": 0, + "beforeGates": [{"type": "str", "displayName": "str"}], + "groups": [ + { + "name": "str", + "afterGates": [{"type": "str", "displayName": "str"}], + "beforeGates": [{"type": "str", "displayName": "str"}], + } + ], + } + ] + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -155,7 +244,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 +252,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 +265,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 +279,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 +292,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..3282aa1e32e9 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,18 +46,19 @@ 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, fleet_name="str", update_run_name="str", resource={ + "autoUpgradeProfileId": "str", "eTag": "str", "id": "str", "managedClusterUpdate": { "upgrade": {"type": "str", "kubernetesVersion": "str"}, - "nodeImageSelection": {"type": "str"}, + "nodeImageSelection": {"type": "str", "customNodeImageVersions": [{"version": "str"}]}, }, "name": "str", "provisioningState": "str", @@ -65,6 +66,24 @@ async def test_begin_create_or_update(self, resource_group): "nodeImageSelection": {"selectedNodeImageVersions": [{"version": "str"}]}, "stages": [ { + "afterGates": [ + { + "displayName": "str", + "gateId": "str", + "status": { + "completedTime": "2020-02-20 00:00:00", + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + } + ], "afterStageWaitStatus": { "status": { "completedTime": "2020-02-20 00:00:00", @@ -80,8 +99,62 @@ async def test_begin_create_or_update(self, resource_group): }, "waitDurationInSeconds": 0, }, + "beforeGates": [ + { + "displayName": "str", + "gateId": "str", + "status": { + "completedTime": "2020-02-20 00:00:00", + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + } + ], "groups": [ { + "afterGates": [ + { + "displayName": "str", + "gateId": "str", + "status": { + "completedTime": "2020-02-20 00:00:00", + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + } + ], + "beforeGates": [ + { + "displayName": "str", + "gateId": "str", + "status": { + "completedTime": "2020-02-20 00:00:00", + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "startTime": "2020-02-20 00:00:00", + "state": "str", + }, + } + ], "members": [ { "clusterResourceId": "str", @@ -146,7 +219,21 @@ async def test_begin_create_or_update(self, resource_group): }, }, "strategy": { - "stages": [{"name": "str", "afterStageWaitInSeconds": 0, "groups": [{"name": "str"}]}] + "stages": [ + { + "name": "str", + "afterGates": [{"type": "str", "displayName": "str"}], + "afterStageWaitInSeconds": 0, + "beforeGates": [{"type": "str", "displayName": "str"}], + "groups": [ + { + "name": "str", + "afterGates": [{"type": "str", "displayName": "str"}], + "beforeGates": [{"type": "str", "displayName": "str"}], + } + ], + } + ] }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -159,7 +246,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 +255,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 +270,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 +286,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 +301,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/sdk_packaging.toml b/sdk/containerservice/azure-mgmt-containerservicefleet/sdk_packaging.toml index 69922ee304fe..f74dece5b231 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/sdk_packaging.toml +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/sdk_packaging.toml @@ -3,7 +3,7 @@ package_name = "azure-mgmt-containerservicefleet" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Containerservicefleet Management" package_doc_id = "" -is_stable = true +is_stable = false is_arm = true need_msrestazure = false need_azuremgmtcore = true diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/setup.py b/sdk/containerservice/azure-mgmt-containerservicefleet/setup.py index d354cdd33896..936f1c3bf59f 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) @@ -51,7 +49,7 @@ url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3",